Skip to content

integralFractionalFromString

integralFractionalFromString(text): IntegralFractional

Defined in: packages/math-numbers/src/integral-fractional.ts:55

Parses a decimal numeral into its IntegralFractional decomposition.

Accepts an optional sign, an optional exponent, and a point on either side of the digits (.5 and 5. both parse). The exponent is applied by moving the point, so 1e-7 yields seven decimal places rather than none — a plain string scan of the printed form would miss that.

Trailing zeros are preserved: "1.50" gives fracDigits: 2, so a numeral’s own precision survives the round trip through integralFractionalToString.

string

The numeral to read. Surrounding whitespace is ignored.

IntegralFractional

The decomposition.

If text is not a decimal numeral. NaN and ±∞ are not, having no decomposition.