07-19-2018 02:48 PM
Discovered a bug in the labVIEW constant for Pi.
Actual value 3.14159265358979323846 according to a number of sites (http://www.geom.uiuc.edu/~huberty/math5337/groupe/digits.html),
LabVIEW value for Pi when indicator is set to 25 digits of precision ((only shows up to 16 decimal points which is probably the limit) : 3.1415926535897931
The last digit should stay rounded at 2, and if the precision went one more, then we would see the 3 round up to 4 because of the 8.
This causes issues believe it or not when solving some equations, it took us awhile to find it.
Solved! Go to Solution.
07-19-2018 02:58 PM
07-19-2018 03:01 PM
That's a limitation of double precision numbers. There is no way to represent 3.1415926535897932 as a double precision number.
You can try using extended precision numbers.
07-19-2018 03:39 PM - edited 07-19-2018 03:40 PM
LabVIEW help for pi constant says 3.1415926535897932. If it can't be represented properly at double precision, NI shouldn't be storing it as such. I'd call that a bug.
07-19-2018 03:46 PM
07-19-2018 03:50 PM
*Sigh* Pi to two decimal places is good enough to insert a probe into orbit around Jupiter.
07-19-2018 04:06 PM
@GerdW wrote:
Hi mancho,
.... You can switch the pi constant to SGL or EXT...
I didn't even know you could change representation of constants. That's interesting. Thanks.
07-19-2018 04:06 PM - edited 07-19-2018 04:07 PM
To answer GerdW , I'm using extended precision. For my system, it allows for ~17 digits of precision.
07-19-2018 04:25 PM
@billko wrote:
*Sigh* Pi to two decimal places is good enough to insert a probe into orbit around Jupiter.
Yes, but you may prefer more precision if they put a probe in Uranus.
07-19-2018 04:36 PM
This is strange! If you change the Pi constant to extended precision and wire it to an Extended indicator, you get the correct "2" digit at position 16 (but can't display additional numbers). It does look like going to Extended (at least for Pi) can get you another decimal digit ... Weird. I'm not sure whether to call this a Bug or a Feature.
Bob Schor