alexgutteridge / rsruby

Ruby - R bridge.
http://rubyforge.org/projects/rsruby/
GNU Lesser General Public License v2.1
332 stars 59 forks source link

Number size #13

Closed matejuh closed 12 years ago

matejuh commented 12 years ago

Is there any reason, why RSRuby can have problems with big numbers? For example with 2482187061?

Simple example:

I can confirm it with this very simple example:

require 'rsruby'

if ENV['R_HOME'].nil?
    ENV['R_HOME'] = "/usr/lib/R"
end

r = RSRuby.instance

r.assign('foo',2482187061)

r.eval_R(<<-RCOMMAND)
    print(foo+1)
RCOMMAND

Result:

/home/matej/.rvm/gems/ruby-1.9.2-p290/gems/rsruby-0.5.1.1/lib/rsruby.rb:148:in `lcall': bignum too big to convert into `long' (RangeError)
    from /home/matej/.rvm/gems/ruby-1.9.2-p290/gems/rsruby-0.5.1.1/lib/rsruby.rb:148:in `method_missing'
    from /home/matej/Programming/doschecker/doschecker_playground/rsruby_testing/issue_test.rb:9:in `<main>'

Is there any way how to fix it?

matejuh commented 12 years ago

I'm sorry. It's R issue and maxint value... Just need to convert it to double.