Inverse Trig Calculations

Quick question: Why the undefined result? Is this an expected “bug”?

1 Like

Hey there! This is a floating point error. We inherit this from Javascript:
> Math.tan(Math.PI/4)
0.9999999999999999
making 1/tan(pi/4) slightly larger than 1.

We actually cheat some other trig functions to get them to produce exactly 0 in some cases, but we don’t cheat this case because it already displays as 1 even though it’s not exactly 1.
image

Appreciated. This will be a lead-in to a teaching lesson on computer calculations.