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

stdlib: Improve sin, cos and tan (*/1/3) #457

Merged
merged 3 commits into from
Jan 1, 2020

Conversation

statementreply
Copy link
Contributor

Robust: 2*/4 (Does it work for all input values?)
Accurate: 1/4 (How accurate is the result?)
Well behaved: 3/4 (Does it preserve math properties?)

* They technically work for all input values. But for very large input, the loss of accuracy makes them practically useless.

The result could be severely inaccurate either when the angle is very large, or when the angle is very close to a multiple of pi/2.

Robust: ^/4 (Does it work for all input values?)
Accurate: 1/4 (How accurate is the result?)
Well behaved: 3/4 (Does it preserve math properties?)

^ They technically work for all input values. But for very large input,
the loss of accuracy makes them practically useless.

The result could be severely inaccurate either when the angle is very
large, or when the angle is very close to a multiple of pi/2.
@LingDong-
Copy link
Member

LingDong- commented Dec 31, 2019

Great, thanks! These math are starting to get too complex for me to comprehend, but I'm going to trust you since you seem to be very good at it :)

@antfu I'm wondering if you could please merge & update the tests? They're probably failing because the results are (hopefully) more accurate. I recall that the floating point results are different on different OS's, hence updating tests on my laptop will probably fail Github?

Thanks!

@antfu
Copy link
Member

antfu commented Jan 1, 2020

Sure. I will have a look tomorrow and probably trying to find out a way to solve the floating number output precision problem.

Happy New Year btw!

@statementreply
Copy link
Contributor Author

The failing test is 施「餘弦」於「圓周率」。書之。 due to improved accuracy of 餘弦. I've updated the test snapshot.

@LingDong- LingDong- merged commit cea0e40 into wenyan-lang:master Jan 1, 2020
@LingDong-
Copy link
Member

thanks and happy new year everyone

This was referenced Jan 2, 2020
@statementreply statementreply deleted the lib-math-5 branch January 11, 2020 11:30
LingDong- added a commit that referenced this pull request Jan 20, 2020
stdlib: Improve sin, cos and tan (*/1/3)
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

Successfully merging this pull request may close these issues.

None yet

3 participants