Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trig functions ( sin(π), cos(π/2) ) evaluate incorrectly #209

Open
sohxet opened this issue Aug 23, 2021 · 2 comments
Open

Trig functions ( sin(π), cos(π/2) ) evaluate incorrectly #209

sohxet opened this issue Aug 23, 2021 · 2 comments

Comments

@sohxet
Copy link

sohxet commented Aug 23, 2021

Actual behaviour:
When calculating these values the app incorrectly returns
sin(π) = 122.465E-18
sin(-π) = -122.465E-18
cos(π/2) = 61.232E-18
cos(-π/2) = 61.232E-18

As a result Euler's formula also evaluates incorrectly { Euler's formula: e^(i*θ) = cos(θ) + i*sin(θ) }
e^(i*π) = -1 + i*122.465E-18
e^(i*π/2) = 61.232E-18 + i

Expected behaviour:
sin(π) = sin(-π) = 0
cos(π/2) = cos(-π/2) = 0
e^(i*π) = -1
e^(i*π/2) = i

Screenshot_20210823-155353_Calculator++
Screenshot_20210823-155331_Calculator++
Screenshot_20210823-155316_Calculator++
Screenshot_20210823-155300_Calculator++

@sohxet sohxet changed the title Sin(pi), cos(pi/2) evaluate incorrectly Trig functions ( sin(±pi), cos(±pi/2) ) evaluate incorrectly Aug 23, 2021
@sohxet sohxet changed the title Trig functions ( sin(±pi), cos(±pi/2) ) evaluate incorrectly Trig functions ( sin(±π), cos(±π/2) ) evaluate incorrectly Aug 23, 2021
@sohxet sohxet changed the title Trig functions ( sin(±π), cos(±π/2) ) evaluate incorrectly Trig functions ( sin(π), cos(π/2) ) evaluate incorrectly Aug 23, 2021
@Cloud-Galaxyman
Copy link

Cloud-Galaxyman commented Oct 23, 2021

I'm also having this issue. I'm glad this is on GitHub, and I love the UI and features of the calculator, but getting sin(π) as 122.4646799147E-18, just kind of freaks me out.
Like how can I trust this calculator on my HW if it can't do trig that I can do in my head?

@hackerb9
Copy link

This is not a fix, but you can workaround the problem by going to settings and changing the Number Format from Engineering to Decimal. It will no longer show exponential notation which means infinitesimal numbers like 10^-16 will be shown as 0.

Screenshot_20230125-104448

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants