-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
BigMath.exp and log missing #1186
Comments
Taking a stab at it ... (far from sure this will work out though). |
Kind of stuck on this ...
|
Bleh, sorry for the trouble. Just run the following to get set up with the gems you need:
Then |
OK thanks for this advice on twitter.
That worked. It took me a while to figure out to deactive rvm with
|
A next issue is how to run a single test and get a newly added module function in the module properly loaded ... With this dummy implementation:
The test on
|
You will want to define the method like this: module BigMath
def log(x, prec)
...
end
module_function :log
end And to run an individual test you can just jruby -n . |
Thanks for the reply, but kind of weird though ... The entire module already has:
Which turns copies all follow-on methods into module methods. Second, when running the full test suite with It is only when running a single test file with Sorry, but I also fail to understand on the
Thanks! |
OK, fixed it with this diff. I will commit this in my branch.
The isolated test needed an extra require (not surprisingly ... on the file that has the method under test). This require otherwise seemed to appear earlier in the test sequence in a require by test_bigmath.rb. Maybe this problem occurs in more places, that tests in isolation have hidden dependencies on other tests? Now I get the expected single failure on the returned value (10):
Thanks again @headius for the support on this. |
If this file needs to be required for the test, we should fix that in MRI's tests too. I have commit rights there, so I'll take care of that. Looks like you're on your way to impl now! |
Strange....jruby master has that require line for me already. |
Strange indeed. I just fetched/pulled again a few minutes ago and redid that commit here. Let's compare absolute sha's
All the rest starts to work nicely now ... (with 1 test actived log(1).should == 0),
|
Interestingly, this is the 160 line C implementation that we want to reproduce in JRuby ... (from https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2777-2937 )
|
There are definitely open-source libraries that add additional BigDecimal capabilities on top of Java's BigDecimal, and some which provide their own BigDecimal impls too. But since we only need two methods, I'm reluctant to pull in yet another external library. So...
|
I am already working on the translation of the C implementation to Ruby. Going well :-) See https://github.com/petervandenabeele/jruby/compare/gh-1186-BigMath-log for the progress. |
So, this is going to work out, nearly there ... |
Fixed by #1235. Thank you! |
For clarity #1235 only implemented BigMath.log. Will see if I find time for BigMath.exp |
Ahh of course. I will reopen. |
exp was added in 9.0.1. |
Need to implement these.
The text was updated successfully, but these errors were encountered: