-
Notifications
You must be signed in to change notification settings - Fork 79
Implement major math functions #336
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
base: master
Are you sure you want to change the base?
Conversation
1a93b02
to
5ebf5dc
Compare
f29ba89
to
316d713
Compare
return BigDecimal::NAN if x.nan? | ||
return BigDecimal::INFINITY if x.infinite? == 1 | ||
|
||
prec2 = prec + BigDecimal.double_fig * 3 / 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: why do we decide what prec2
is needed? It differs between the functions and I'm wondering how it's calculated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally, BigMath functions calculate with prec+BigDecimal.double_fig
precision.
I think BigMath.log2(1024, prec)
is expected to return exactly 10
. To calculate exact value for 2**n
numbers, we need to round the result to precision = prec+BigDecimal.double_fig
.
log(x)/log(2)
should be calculated with prec + BigDecimal.double_fig + extra
precision.
I decided to use extra=BigDeciaml.double_fig/2
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
316d713
to
a2f13fa
Compare
a2f13fa
to
4385bbd
Compare
Calculate `tan(x, prec)` by `relative_precision_sin/relative_precision_cos`.
4385bbd
to
1c37330
Compare
1c37330
to
f9b5a97
Compare
Implement these methods
Remaining methods