Handling big FP numbers
Murilo
murilomiranda92 at hotmail.com
Sat Feb 9 03:52:38 UTC 2019
On Saturday, 9 February 2019 at 03:28:24 UTC, Adam D. Ruppe wrote:
> On Saturday, 9 February 2019 at 03:21:51 UTC, Murilo wrote:
>> Now, changing a little bit the subject. All FPs in D turn out
>> to be printed differently than they are in C and in C it comes
>> out a little more precise than in D. Is this really supposed
>> to happen?
>
> Like I said in my first message, the D default rounds off more
> than the C default. This usually results in more readable stuff
> - the extra noise at the end is not that helpful in most cases.
>
> But you can change this with the format specifiers (use
> `writefln` instead of `writeln` and give a precision argument)
> or, of course, you can use the same C printf function from D.
Thanks, but which precision specifier should I use? I already
tried "%.20f" but it still produces a result different from C? Is
there a way to make it identical to C?
More information about the Digitalmars-d-learn
mailing list