Separate Printing Mantissa and Exponent of a Floating Point
"Nordlöw" via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 13 00:51:29 PDT 2014
On Monday, 11 August 2014 at 15:30:30 UTC, Justin Whear wrote:
> 1. http://dlang.org/phobos/std_bitmanip.html#.FloatRep
Could someone briefly outline the algorithm that converts the
fraction part of FloatRep into a string in base 10?
My first guess is
sum = 0;
foreach (bit_index i, bit_value b; fraction)
if (b == 1)
sum += 2^^(-i);
return to!string(sum);
/Per
More information about the Digitalmars-d-learn
mailing list