class BSON::Decimal128::Builder::FromString

def to_bits

def to_bits
  _, sign, digits_str = SIGN_AND_DIGITS_REGEX.match(@string).to_a
  digits, _, scientific_exp = digits_str.partition(SCIENTIFIC_EXPONENT_REGEX)
  before_decimal, _, after_decimal = digits.partition('.')
  significand_str = before_decimal << after_decimal
  significand_str = SIGNIFICAND_WITH_LEADING_ZEROS_REGEX.match(significand_str).to_a[2]
  exponent = -(after_decimal.length)
  exponent = exponent + scientific_exp.to_i
  exponent, significand_str = round_exact(exponent, significand_str)
  exponent, significand_str = clamp(exponent, significand_str)
  Builder.parts_to_bits(significand_str.to_i, exponent, sign == '-')
end