Incorrect presentation of value zero when using Degree-based trigonometric functions

Issue #832 new
Former user created an issue

Math: sin(a)*cos(b) - sin(b)*cos(a) = sin(a-b)

Speedcrunch (v0.12 portable): sin(7*30)*cos(30) - sin(30)*cos(7*30) = **1e-80**

screenshot

PS. Good calc, I use it everyday. Just check your math sometimes, OK?

Comments (12)

  1. Helder Correia repo owner

    With the latest code from the development branch, I get (with Radian angle unit):

    sin(730)cos(30) - sin(30)cos(730)
    = 0,5439705233633756381
    
    sin(730-30)
    = 0,5439705233633756381
    
  2. Helder Correia 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.

  3. Tey'

    @heldercorreia Check in degree:

    #!
    
    sin(7×30)cos(30) - sin(30)cos(7×30)
    = 1e80
    
    (sin(7×30)cos(30) - sin(30)cos(7×30))  sin(7×3030)
    = 1e80
    
    sin(7×3030)
    = 0
    

    Works in radian though:

    #!
    
    sin(7×30degree)cos(30degree) - cos(7×30degree)sin(30degree)
    = 1e80
    
  4. Helder Correia 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 mentions 730.

  5. Tey'

    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 ^_^

  6. Tey'

    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)
    = 1e80
    

    But it works in gradian(!?):

    #!
    
    sin(7×30degree)cos(30degree) - cos(7×30degree)sin(30degree)
    = 0
    
  7. Pol Welter

    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.

  8. Pol Welter

    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.

  9. Log in to comment