Constructs Decimal from the floating point number using the Ryu algorithm.
Handle thousand separators for non exponential numbers.
Mir parsing supports up-to quadruple precision. The conversion error is 0 ULP for normal numbers. Subnormal numbers with an exponent greater than or equal to -512 have upper error bound equal to 1 ULP.
count of 64bit words in coefficient
import mir.conv: to; Decimal!3 decimal; DecimalExponentKey key; import mir.math.constant: PI; assert(decimal.fromStringImpl("3.141592653589793378e-10", key)); assert(cast(double) decimal == double(PI) / 1e10); assert(key == DecimalExponentKey.e);
import mir.conv: to; Decimal!3 decimal; DecimalExponentKey key; assert(decimal.fromStringImpl("0", key)); assert(key == DecimalExponentKey.none); assert(decimal.exponent == 0); assert(decimal.coefficient.length == 0); assert(!decimal.coefficient.sign); assert(cast(double) decimal.coefficient == 0); assert(decimal.fromStringImpl("-0.0", key)); assert(key == DecimalExponentKey.dot); assert(decimal.exponent == -1); assert(decimal.coefficient.length == 0); assert(decimal.coefficient.sign); assert(cast(double) decimal.coefficient == 0); assert(decimal.fromStringImpl("0e0", key)); assert(key == DecimalExponentKey.e); assert(decimal.exponent == 0); assert(decimal.coefficient.length == 0); assert(!decimal.coefficient.sign); assert(cast(double) decimal.coefficient == 0);
Stack-allocated decimal type.