"%a" formatting differences

BCS none at anon.com
Mon Dec 14 11:50:42 PST 2009


Hello bearophile,

> Do you know what's causing the difference in the outouts?
> 
> void main() {
> double d1 = 3.14159;
> printf("%a\n", d1);
> writefln("%a\n", d1);
> }
> Outputs:
> 0x1.921f9f01b866ep+1
> 0xc.90fcf80dc337p-2
> A printf in C code compiled with GCC prints the same as the printf
> here.
> 
> Bye,
> bearophile

Just a guess: D is correctly using double and C is assuming float? Try running 
it with d1 as a float to check.




More information about the Digitalmars-d-learn mailing list