[HP 35s] Hosoda trig program giving incorrect answers to certain angles - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: [HP 35s] Hosoda trig program giving incorrect answers to certain angles (/thread-4483.html) [HP 35s] Hosoda trig program giving incorrect answers to certain angles - Marcio - 08-05-2015 02:36 PM Hello all, After clearing all variables and registers, I noticed that Hosoda gives wrong answers to certain angles (cosine) on my 35s: $\begin{matrix} & Hosoda & 35s & 34s & 50g \\ 5\frac { \pi }{ 180 } & 9.96194698092E-1 & 9.96194698092E-1 & 9.96194698092E-1 & 9.96194698092E-1 \\ 75\frac { \pi }{ 180 } & 2.58819045098E-1 & 2.58819045098E-1 & 2.58819045103E-1 & 2.58819045108E-1 \\ 89.999\frac { \pi }{ 180 } & 1.74532948958E-5 & 1.74532948891E-5 & 1.74532925187E-5 & 1.74532948957E-5 \\ 89.9999\frac { \pi }{ 180 } & 1.74532489662E-6 & 1.74532489000E-6 & 1.74532925262E-6 & 1.74532489662E-6 \end{matrix}$ Does anybody have any idea as to what is happening? Maybe I am missing something here? I have already double-checked all program lines and everything is exactly as before. Very much appreciated. Marcio CORRECTION: Hosoda trig program is working as expected, it was I who "forgot" about the significant loss of accuracy that occurs while converting from DEG to RAD, as pointed out by our dear friend Gerald. RE: [HP 35s] Hosoda trig program giving incorrect answers for certain angles - toml_12953 - 08-05-2015 02:49 PM (08-05-2015 02:36 PM)Marcio Wrote:  Hello all, After clearing all variables and registers, I noticed that Hosoda gives wrong answers to certain angles (cosine) on my 35s: $\begin{matrix} & Hosoda & 35s & 34s \\ 5 & 9.96194698092E-1 & 9.96194698092E-1 & 9.96194698092E-1 \\ 75 & 2.58819045098E-1 & 2.58819045103E-1 & 2.58819045103E-1 \\ 89.999 & 1.74532948958E-5 & 1.74532925091E-5 & 1.74532925191E-5 \\ 89.9999 & 1.74532489662E-6 & 1.74532925000E-6 & 1.74532925199E-6 \end{matrix}$ Does anybody have any idea as to what is happening? Maybe I am missing something here? I have already double-checked all program lines and everything is exactly as before. Very much appreciated. Marcio Could it be related to the fact that near 90° the 35s trig functions have very limited accuracy? (about four digits only) Tom L RE: [HP 35s] Hosoda trig program giving incorrect answers for certain angles - Marcio - 08-05-2015 02:57 PM (08-05-2015 02:49 PM)toml_12953 Wrote:  Could it be related to the fact that near 90° the 35s trig functions have very limited accuracy? (about four digits only) Tom L Well, the 35s does have troubles getting all digits correct when the angles are very small (1E-7°) or near 90°, as in 89.9999° (four decimals, not three), but the Hosoda code, a 3rd party program, is supposed to get digits right. I myself have been working with it a lot lately and yesterday, after clearing everything, I noticed this weird behaviour. I suspect it has to do with some registers not being real numbers, and they got erased, I know, it seems crazy but it is all I can remember from yesterday. To make matters worse, while $$e^x$$ is stable across the entire domain on the 35s, $$e^{ix}$$ shows the same instability as observed on the trig functions calculated by the 35s on those very same angles. RE: [HP 35s] Hosoda trig program giving incorrect answers for certain angles - Gerald H - 08-05-2015 03:17 PM Hosoda's programmes only work in radian measures. For 75°, ie 75 * pi / 180, the programme returned 2.58819045108E-1 ie I did the ->RAD by hand, not using the built-in function. Other values as you have them. RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles - Marcio - 08-05-2015 03:19 PM (08-05-2015 03:17 PM)Gerald H Wrote:  Hosoda's programmes only work in radian measures. For 75°, ie 75 * pi / 180, the programme returned 2.58819045108E-1 Other values as you have them. Yes, I converted them to RAD before calling the routines. EDIT: The last digit of your answer reads 8. Is it not 3? RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles - Gerald H - 08-05-2015 03:25 PM I've now edited my posting to show I did not use the built-in ->RAD function. RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles - Marcio - 08-05-2015 03:29 PM (08-05-2015 03:25 PM)Gerald H Wrote:  I've now edited my posting to show I did not use the built-in ->RAD function. That's alright. Regarding the incorrect answers, what do you, as an experienced user, think? Thanks Marcio RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles - Gerald H - 08-05-2015 03:31 PM I, as a lazy user, think the conversion ->RAD produces inaccuracies & Hosoda's programmes may be inaccurate near the cusp. RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles - Gerald H - 08-05-2015 03:44 PM 89.9999 ->RAD gives 1.57079458147 on the 35S actual value is more like 1.57079458146564... so you can't expect so much accuracy from the result. RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles - Marcio - 08-05-2015 03:47 PM My dear Gerald, with all due respect, I think you're missing the point. Please, have another look at the table at the beginning. Until recently, the Hososa code I have here gave the same answers as the 34s, which uses more digits deep inside. Thanks Marcio RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles - Gerald H - 08-05-2015 03:50 PM Try inputting 1.57079458147 on the 34S & see the value returned. RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles - Gerald H - 08-05-2015 04:21 PM & on my trusty HP 48S 89.9999° COS returns 1.74532925199E-6 & converted to radians 1.57079458147 returns1.74532489662E-6 RE: [HP 35s] Hosoda trig program giving incorrect answers to certain angles - Marcio - 08-05-2015 04:23 PM Yes, you're 100% correct. It was just another lapse of mine! I never thought the impact would be that big though! Thank you for pointing that out. EDIT: I have also updated the table. Marcio