-
Notifications
You must be signed in to change notification settings - Fork 91
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
can't get examples to work #8
Comments
Hi Derek, Thanks for letting me know about this. It's always nice to hear from people that are using the gem! First, I just want to confirm a few things: what version of ruby, rails, and the finance gem are you using? Right now, I am working with ruby 1.9.3-p0, no rails, and finance-1.1.1.gem. The examples you mentioned are currently in the unit tests, which pass on my machine. So I just want to make sure that we are starting from the same place. Thanks, |
hey bill, I was overjoyed when I found a finance gem :P - I am envious of those python guys and their scipy numpy libs, this is a great start :). The ticket above refers to rails version 3.0.9 and ruby 1.9.2p180 and p290 |
in particular the code seems to have problems with this line in cashflows.rb
|
Hi Derek, I have verified the error (on the line you specified) on a fresh install of Ruby 1.9.2p180 with rails 3.2.3. That said, I'm not sure why this is happening. Adding I should have more time to go through this during the weekend. Thanks, |
Thanks Bill! Very much appreciated. I've tried tinkering around with it for a few hours yesterday, I think it might have something to do with the fact that rails changes the Time class injecting its own methods in. I'm not 100% certain though, in the end I couldn't get it going :/. Thanks for your help on this :) |
I can also confirm this bug happening while using ruby 1.9.3p194, Rails 3.2.5 and finance 1.1.2 |
+1 |
I get
|
So, interestingly, I see this problem as well, but using the 'flt' directly (rather than through the 'finance' gem) and only on Linux for some reason (on OSX it's fine) Specifically, these values are an example of what triggers it:
And just like @MoustafaEid, I can't reproduce from within a Rails console |
So, for me at least it seems like a Ruby build version problem. Upgraded from 1.9.3-p125 to 1.9.3-p194 and it went away. Worth giving a shot. |
@derekyau @MoustafaEid @wmilesn @suan This issue is now quite old :) Is it still a live problem for anyone, and does it require further investigation? |
sorry, i may be missing something here (probably am :/)
but I just installed the gem (which is awesome by the way thanks for starting this!)
I wasn't able to get the examples working, this is within the context of a rails stack.
when I try the IRR example
[-4000,1200,1410,1875,1050].irr
I seem to be getting the error
Flt::DecNum can't be coerced into BigDecimal
This seems to be working fine in the rails console though.
as for the xirr example
@transactions = [] @transactions << Transaction.new(-1000, :date => Time.new(1985,01,01)) @transactions << Transaction.new( 600, :date => Time.new(1990,01,01)) @transactions << Transaction.new( 600, :date => Time.new(1995,01,01)) @transactions.xirr(0.6)
I am getting this error
wrong argument type Float (expected Fixnum)
not quite sure what I am doing wrong, anyone have an idea?
Thanks!
The text was updated successfully, but these errors were encountered: