Stop to! rounding?
Josh
moonburntm at gmail.com
Tue Jul 2 21:44:33 PDT 2013
On Wednesday, 3 July 2013 at 04:32:15 UTC, Jonathan M Davis wrote:
> On Wednesday, July 03, 2013 06:23:12 Josh wrote:
>> writeln(to!double("151.42499")); //prints 151.425
>>
>> Is there any way to stop this rounding?
>
> No. double can't hold the value 151.42499. There are _tons_ of
> values that it
> can't hold exactly. The same goes for float and real. Floating
> point values are
> rounded all the time. Note that
>
> double d = 151.42499;
> writeln(d);
>
> prints exactly the same thing as your example.
>
> - Jonathan M Davis
Is there any way I would be able to hold that number then?
Thanks,
Josh
More information about the Digitalmars-d-learn
mailing list