!pi: Stored as a float [message #28472] |
Wed, 12 December 2001 12:22 |
Andy Loughe
Messages: 174 Registered: November 1995
|
Senior Member |
|
|
Being stored as a float, the !pi system variable is accurate
to about the 6th decimal place.
IDL> print, !pi, format='(f25.23)'
3.14159274101257324218750
IDL> print, atan(1.0)*4.0, format='(f25.23)'
3.14159274101257324218750
IDL> print, size(!pi, /type) ;; 4 = Floating point
4
This would be better:
IDL> DEFSYSV, '!mypi', atan(1D)*4D, 1
IDL> print, size(!mypi, /type) ;; 5 = Double Precision
5
IDL> print, !mypi, format='(f25.23)'
3.14159265358979311599796
3.14159265358979323846264338327950288419716939937510 <- joyofpi.com
--
Andrew Loughe =====================================================
NOAA/OAR/FSL/AD R/FS5 | email: loughe@fsl.noaa.gov
325 Broadway | wwweb: www-ad.fsl.noaa.gov/users/loughe
Boulder, CO 80305-3328 | phone: 303-497-6211 fax: 303-497-6301
|
|
|