Re: Pi is Rotten? [message #88050 is a reply to message #88049] |
Fri, 14 March 2014 11:30   |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
In case anyone might think the sky is actually falling, at least with IDL 8.2.3
Windows 7 64-bit:
IDL> print,!dpi,format='(F25.23)'
3.14159265358979310000000
IDL> print,!const.pi,format='(F25.23)'
3.14159265358979310000000
And I think this can reassure us that at that digit position, double precision
does not distinguish between those two values:
IDL> print,3.1415926535897932D EQ 3.1415926535897931D
1
Further:
IDL> print,3.1415926535897928D EQ 3.1415926535897931D
0
IDL> print,3.1415926535897929D EQ 3.1415926535897931D
1
IDL> print,3.1415926535897930D EQ 3.1415926535897931D
1
IDL> print,3.1415926535897931D EQ 3.1415926535897931D
1
IDL> print,3.1415926535897932D EQ 3.1415926535897931D
1
IDL> print,3.1415926535897933D EQ 3.1415926535897931D
1
IDL> print,3.1415926535897934D EQ 3.1415926535897931D
0
https://www.idlcoyote.com/math_tips/sky_is_falling.html
Cheers,
-Dick
Dick Jackson Software Consulting Inc.
Victoria, BC, Canada
www.d-jackson.com
On Friday, March 14, 2014 6:17:51 AM UTC-7, David Fanning wrote:
> Folks,
>
> Perhaps because today is Pi Day:
>
> http://bit.ly/1lDkQi4
>
> Andrew Cools alerts me to an IDL problem of utmost importance. I refer,
> of course, to an inexplicable problem with IDL's version of Pi:
>
> IDL> print, !dpi, format='(f0.18)'
> 3.1415926535897931
>
> As everyone knows, the actual value of Pi is 3.1415926535897932. The
> last digit here is a "2", not a "1".
>
> http://bit.ly/1qCvycp
>
> Even ExelisVis itself realizes this, and puts the proper value in the
> new !Const system variable. What's up with this? Can we ever trust IDL
> again?
>
> Cheers,
> David
>
> P.S. Let's just say I'm off to get a piece of apple with my morning Joe.
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|