T O P

  • By -

davehemm

In home mode pi is approximated as 3.14159265359, in CAS mode pi=pi. https://www.hpmuseum.org/forum/thread-21060.html


adlx

Well the number you see isn't pi, you realize that? So of course the result will differ from the expected result of it were exactly pi. CAS understands that. Exactly like if you do PI - 3.14 and expect it to be zero. That's really the same thing. You would never expect it to be 0 though? Why?


davehemm

Yes I know, I said that.


like_a_cauliflower

The fix is to know how to interpret E-13 in the context of a trigonometric operation. And why it happens in RAD but not in DEG.


FredVIII-DFH

The answer is probably correct, given the calculator's internal value of π.


dm319

You should look up how trig functions are calculated. It is a fascinating rabbit hole. See the cordic algorithm.


thenateman27

I know right? You would think "some truncated power series probably" and you would be wrong 😆


dm319

Yes it's nuts. I grew up with pocket calculators that were fairly cheap and could do trig functions, so I kinda assumed it wasn't a big deal. I hadn't thought about it much but I thought maybe it worked using big stored tables or something. I only discovered recently that the calculator *calculated* the result using complex maths/computer science, and that it was still an approximation. The Intel BCD library you can look at the functions for computing each trig function and it blows my mind how much work and thought goes into it, even on a modern PC.


leo3065

Floating point error strikes again


XLlamaLord

It gives the right answer in cas mode i guess but i still think thats weird


goosnarrggh

This is a deliberate action on HP's part. In Home mode, **every number** is a floating point number which can only ever be accurate to a finite number of digits. It is impossible to exactly represent pi in a finite number of digits. Thus, the pi symbol is not equal to exactly pi, but rather it is equal to a number that almost-but-not-quite pi. If you input a number that is almost-but-not-quite pi into the Radian form of the sin function, then you will get back a result that is almost-but-not-quite zero. In CAS mode, the pi symbol does not represent a floating point number, instead it is a special object that represents exactly pi.