The Museum of HP Calculators

HP Forum Archive 17

 Re: Valentine's Day MC: A few modest insights, n! digits - part 3, anyone?Message #1 Posted by Gerson W. Barbosa on 22 Feb 2007, 6:05 p.m. Hello Valentin, I have noticed these two discrepancies between your HP-15C and HP-71B programs, when checking against the HP-200LX: ``` N HP-15C HP-200LX HP-71B 44315509 319615034 319615033 319615033 54336595 396700506 396700505 396700506 ``` This suggests the HP-15C fails for N=44315509 and the HP-71B fails for N=54336595. The 200LX equation is the following: ```NDF=INT(N*LOG(N/EXP(1))+LOG(2*PI*N)/2+1) ``` On the HP-200LX, the second result is 396700505.9999999. It appears to be one of the cases the guard digits are not enough... This should be checked with more digits, though. Apparently, these are the only two discrepancies in the range [1..100,000,000]. Best regards, Gerson. Edited: 22 Feb 2007, 6:11 p.m.

 Re: Valentine's Day MC: A few modest insights, n! digits - part 3, anyone?Message #2 Posted by Valentin Albillo on 22 Feb 2007, 7:14 p.m.,in response to message #1 by Gerson W. Barbosa Hi, Gerson: Gerson posted: "I have noticed these two discrepancies between your HP-15C and HP-71B programs, when checking against the HP-200LX [...] This suggests the HP-15C fails for N=44315509 and the HP-71B fails for N=54336595 [...] This should be checked with more digits, though." Seems to me you're right. Checking with my SHARP PC-1475 produces: ``` N=54336595 396700505.99999998701 N=44315509 319615034.00000004201 ``` which are absolutely correct to the 20 digits shown. I haven't checked that these are the only cases in the range, but this kind of off-by-one results isn't exactly a surprise since they are to be expected when working with transcendental functions with large inputs/outputs near the maximum significant digit limit of the computing device. In these cases even two or three internal guard digits just aren't enough and either you restrict the range or else you use a double-precision capable handheld such as the SHARP PC-1475 or the SHARP PC-E500/E500S just like I did to test the anomalous cases above. Thanks for sharing your interesting findings and Best regards from V.

Go back to the main exhibit hall