Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
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.")
David Fanning <news@idlcoyote.com> 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 Hm, !dpi is a double precision number. It has about 16 useful digits. Due to rounding the last digit is always uncertain. Norbert
Norbert Hahn writes: > David Fanning <news@idlcoyote.com> 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 > > Hm, !dpi is a double precision number. It has about 16 useful digits. > Due to rounding the last digit is always uncertain. That's what I told him. He is not satisfied. :-( Cheers, David -- 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.")
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.")
On Friday, March 14, 2014 7:17:51 AM UTC-6, 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.") David, You might consider updating your Sky is Falling article to include a discussion on the new "implied print" behavior of IDL 8.3. "For floating-point data types, unlike the PRINT procedure, Implied Print will automatically use the maximum number of digits of precision." Will it prevent angry phone calls from researchers at 3 am? Probably not. Jim P.