What is the internal accuracy for Pi in the DM-42?
What is the internal accuracy for Pi in the DM-42?
There is a discussion of the correct result of SIN of exactly 3.141592654 Radians in the HP 15C Advanced Functions handbook Appendix...The Dm-42 gets it correct to a full 34 significant digits, (as I verified in Mathematica...). All of the result numbers are correct...To get that result, the internal figure for Pi must be much higher than the result. Curious how Pi is represented internally in the DM-42 and or what the IEEE Quad Standard calls for regarding the number Pi..
Re: What is the internal accuracy for Pi in the DM-42?
I disagree. I'd guess it's well within Pi +/- 10^(-34).zeno333 wrote: ↑Sat Dec 30, 2017 8:52 amThere is a discussion of the correct result of SIN of exactly 3.141592654 Radians in the HP 15C Advanced Functions handbook Appendix...The Dm-42 gets it correct to a full 34 significant digits, (as I verified in Mathematica...). All of the result numbers are correct...To get that result, the internal figure for Pi must be much higher than the result.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
-
- Posts: 1102
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: What is the internal accuracy for Pi in the DM-42?
The PI function in Free42 Decimal, and thus the DM42, simply returns the 34-digit approximation of pi.
To get the accuracy you noticed for sin(3.141592654), or, in fact, for sin(3.141592653589793238462643383279503), the floating-point library has to use a higher-precision approximation of pi internally.
You could find out exactly how many digits it uses by checking the Intel library's source code. The IEEE-754 standard requires transcendental functions to be accurate to within one ULP; in order for the sine to achieve that on the domain (-pi, pi), its approximation of pi would have to have at least twice as many digits as its highest-precision external floating-point format.
To get the accuracy you noticed for sin(3.141592654), or, in fact, for sin(3.141592653589793238462643383279503), the floating-point library has to use a higher-precision approximation of pi internally.
You could find out exactly how many digits it uses by checking the Intel library's source code. The IEEE-754 standard requires transcendental functions to be accurate to within one ULP; in order for the sine to achieve that on the domain (-pi, pi), its approximation of pi would have to have at least twice as many digits as its highest-precision external floating-point format.
Re: What is the internal accuracy for Pi in the DM-42?
Section 9 of the 2008 version of IEEE 754 says that the recommended functions should be correctly rounded not 1ULP accurate. These functions are optional in the sense that you can claim conformance without them but ...language standards should define, to be implemented according to this subclause, as many of the functions of 9.2 as are appropriate to the language.
Interestingly, the specified domain is the entire real range where the function is defined. This makes the modulo reduction for trigonometric functions quite a challenge. The Intel decimal library uses the binary functions for an initial estimate, so they are possibly religating these difficulties to that library instead.
The WP 34S uses 451 digits in it's internal representation of 2π. This is sufficient to correctly range reduce for single precision (16 digit) inputs but not for double precision (34 digit) ones. To do the latter requires upwards of 8,000 digits and more RAM than the hardware has.
Pauli
Interestingly, the specified domain is the entire real range where the function is defined. This makes the modulo reduction for trigonometric functions quite a challenge. The Intel decimal library uses the binary functions for an initial estimate, so they are possibly religating these difficulties to that library instead.
The WP 34S uses 451 digits in it's internal representation of 2π. This is sufficient to correctly range reduce for single precision (16 digit) inputs but not for double precision (34 digit) ones. To do the latter requires upwards of 8,000 digits and more RAM than the hardware has.
Pauli
-
- Posts: 795
- Joined: Wed May 03, 2017 7:46 pm
- Location: Malone, NY USA
Re: What is the internal accuracy for Pi in the DM-42?
It doesn't need to calculate anything if the value of PI is stored as a literal and the calculator uses tables to display common values (0, PI/2, PI, 3*PI/2, 2*PI) of transcendentals.zeno333 wrote: ↑Sat Dec 30, 2017 8:52 amThere is a discussion of the correct result of SIN of exactly 3.141592654 Radians in the HP 15C Advanced Functions handbook Appendix...The Dm-42 gets it correct to a full 34 significant digits, (as I verified in Mathematica...). All of the result numbers are correct...To get that result, the internal figure for Pi must be much higher than the result. Curious how Pi is represented internally in the DM-42 and or what the IEEE Quad Standard calls for regarding the number Pi..
Tom L
Some people call me inept but I'm as ept as anybody!
DM10L SN: 059/100
DM41X SN: 00023 (Beta)
DM41X SN: 00506 (Shipping)
DM42 SN: 00025 (Beta)
DM42 SN: 00221 (Shipping)
WP43 SN: 00025 (Prototype)
Some people call me inept but I'm as ept as anybody!
DM10L SN: 059/100
DM41X SN: 00023 (Beta)
DM41X SN: 00506 (Shipping)
DM42 SN: 00025 (Beta)
DM42 SN: 00221 (Shipping)
WP43 SN: 00025 (Prototype)
-
- Posts: 1102
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: What is the internal accuracy for Pi in the DM-42?
The Intel library uses a 384-bit approximation of pi, equivalent to 115 decimal digits.
Re: What is the internal accuracy for Pi in the DM-42?
This might cause issues for huge arguments: e.g. sin(1.234E350).Thomas Okken wrote: ↑Sat Dec 30, 2017 3:13 pmThe Intel library uses a 384-bit approximation of pi, equivalent to 115 decimal digits.
Pauli
-
- Posts: 1102
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: What is the internal accuracy for Pi in the DM-42?
Oh, it causes issues much sooner. When I tried the series sin(pi * 10^n), for n = 0, 1, 2, ..., I could see the error start to creep in at around n = 17.pauli wrote: ↑Sun Dec 31, 2017 5:16 amThis might cause issues for huge arguments: e.g. sin(1.234E350).Thomas Okken wrote: ↑Sat Dec 30, 2017 3:13 pmThe Intel library uses a 384-bit approximation of pi, equivalent to 115 decimal digits.
-
- Posts: 1102
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: What is the internal accuracy for Pi in the DM-42?
N.B. To keep this in perspective: On the real HP-42S, you can see the error start to creep in at n = 6. Given that my main objective for Free42 is that it be compatible with the 42S, to the point of being viable as a drop-in replacement, the Intel library is Good Enough™.Thomas Okken wrote: ↑Sun Dec 31, 2017 5:24 amOh, it causes issues much sooner. When I tried the series sin(pi * 10^n), for n = 0, 1, 2, ..., I could see the error start to creep in at around n = 17.pauli wrote: ↑Sun Dec 31, 2017 5:16 amThis might cause issues for huge arguments: e.g. sin(1.234E350).Thomas Okken wrote: ↑Sat Dec 30, 2017 3:13 pmThe Intel library uses a 384-bit approximation of pi, equivalent to 115 decimal digits.
Re: What is the internal accuracy for Pi in the DM-42?
Wow, I'm surprised it is that soon. There must be something else going on for the error to appear this early -- possibly the change from binary to decimal after the initial estimate.Thomas Okken wrote: ↑Sun Dec 31, 2017 5:24 amOh, it causes issues much sooner. When I tried the series sin(pi * 10^n), for n = 0, 1, 2, ..., I could see the error start to creep in at around n = 17.
As you wrote, this is better than the real 42S.
Pauli