fpformat

General floating point formatting functions.

Functions: fix(x, digits_behind) sci(x, digits_behind)

Each takes a number or a string and a number of digits as arguments.

Parameters: x: number to be formatted; or a string resembling a number digits_behind: number of digits behind the decimal point

Functions

extract(s) Return (sign, intpart, fraction, expo) or raise an exception:
fix(x, digs) Format x as [-]ddd.ddd with ‘digs’ digits after the point and at least one digit before.
roundfrac(intpart, fraction, digs) Round or extend the fraction to size digs.
sci(x, digs) Format x as [-]d.dddE[+-]ddd with ‘digs’ digits after the point and exactly one digit before.
test() Interactive test run.
unexpo(intpart, fraction, expo) Remove the exponent by changing intpart and fraction.

Exceptions

NotANumber