// float and double can be used to construct Decimal of any length auto decimal64 = Decimal!1(-1.235e-7); assert(decimal64.exponent == -10); assert(decimal64.coefficient == -1235); // real number may need Decimal at least length of 2 auto decimal128 = Decimal!2(-1.235e-7L); assert(decimal128.exponent == -10); assert(decimal128.coefficient == -1235); decimal128 = Decimal!2(1234e3f); assert(decimal128.exponent == 3); assert(decimal128.coefficient == 1234);
Constructs Decimal from the floating point number using the Ryu algorithm.
The number is the shortest decimal representation that being converted back would result the same floating-point number.