microsoft / calculator

Windows Calculator: A simple yet powerful calculator that ships with Windows
MIT License
29.72k stars 5.39k forks source link

Inaccurate results for trigonometric functions with exact results #309

Open Wazhai opened 5 years ago

Wazhai commented 5 years ago

Describe the bug The below examples of the trigonometric functions show a correct result at first. However, subtracting that result from itself results in a non-zero value, which shows that the results are represented as incorrect approximations internally, when it should be an exact result.

In DEG mode: arcsin(1) - 90 != 0 sin(30) - 0.5 != 0 In RAD mode: sin(π/2) - 1 != 0 but interestingly: cos(±π) + 1 == 0

This is a new issue spawned from the similar issue #222.

Steps To Reproduce

  1. Try the above calculations in scientific mode

Expected behavior Exact internal representation and result 0 for above calculations.

Device and Application Information (please complete the following information):

MicrosoftIssueBot commented 5 years ago

This is your friendly Microsoft Issue Bot. I've seen this issue come in and have gone to tell a human about it.

uhliksk commented 5 years ago

Some situations are not solvable by any conventional way, for example sin ( 42 ) - ( sqrt( 30 + sqrt( 180 ) ) - sqrt( 5 ) + 1 ) / 8 in DEG mode.

grochocki commented 5 years ago

Thanks for creating the report! We should defintiely try to squash these.