printf prints WRONG double precision values

2003-01-16 Thread Ugen
Try this: #include stdio.h int main() { double pi = 3.14159265358979323846 ; printf(%20.19f\n, pi); } and here is what you get: host: [16:45] [127] /tmp./test 3.1415926535897931160 The error in last 4 or digits is obvious. It seems that the culprit is __dtoa which incorrectly turns

Re: printf prints WRONG double precision values

2003-01-16 Thread Kent Stewart
On Thursday 16 January 2003 01:47 pm, Ugen wrote: Try this: #include stdio.h int main() { double pi = 3.14159265358979323846 ; printf(%20.19f\n, pi); } and here is what you get: host: [16:45] [127] /tmp./test 3.1415926535897931160 The error in last 4 or digits is obvious.

Re: printf prints WRONG double precision values

2003-01-16 Thread Gary W. Swearingen
Ugen [EMAIL PROTECTED] writes: double pi = 3.14159265358979323846 ; printf(%20.19f\n, pi); and here is what you get: host: [16:45] [127] /tmp./test 3.1415926535897931160 Function printf is only working with the 64 bits of info in variable pi not the more-than-64 bits of data