Incorrect presentation of value zero when using Degree-based trigonometric functions
Comments (12)
-
repo owner -
repo owner I think there is an issue with the characters you used, try copying from my expressions above and pasting into the calculator. If that's the case, this has been fixed for the upcoming release.
-
repo owner -
@heldercorreia Check in degree:
#! sin(7×30)cos(30) - sin(30)cos(7×30) = 1e−80 (sin(7×30)cos(30) - sin(30)cos(7×30)) − sin(7×30−30) = 1e−80 sin(7×30−30) = 0
Works in radian though:#! sin(7×30degree)cos(30degree) - cos(7×30degree)sin(30degree) = 1e−80
-
repo owner @Teyut Indeed, but where
7*30
coming from? I can't see the OP's screenshot for some reason, and the expression I see in the description mentions730
. -
You can see OP screenshot here. He failed to embed it as an image, and the '*' he wrote in the ticket have been understood as markup symbols by bitbucket ^_^
-
- edited description
Fixed description
-
repo owner - changed title to Incorrect presentation of value zero when using Degree-based trigonometric functions
-
I was wrong btw: it doesn't work in radian either (I typed a wrong formula).
#! sin(7×30degree)cos(30degree) - cos(7×30degree)sin(30degree) = 1e−80
But it works in gradian(!?):
#! sin(7×30degree)cos(30degree) - cos(7×30degree)sin(30degree) = 0
-
I vote to mark this as won't fix. There is no way a non-symbolic math engine could ever solve all cancellation issues like the one here. An IEEE-754 compliant arithmetic would not yield 0 either.
-
repo owner -
Both are correct, which tells us that the Google math engine was either lucky or able to do some symbolic simplifications.
For the record, the windows calculator gives a surprisingly accurate
6,75072532733534530225945968832e-39
. That's better than what I would have expected from even quadruple-precision.On my machine, python 3.6 returns
4,44089E-16
. Excel yields the same value btw, so I guess that's the value that my FPU and my system's math libraries cook up. - Log in to comment
With the latest code from the development branch, I get (with Radian angle unit):