I'm trying to replicate a javascript check digit function in Ruby. The results are differing and it looks as though it is related to the size of the integer.
in Ruby:
puts "#{1421974191} | #{(1421974191 << 5)}"
produces 1421974191 | 45503174112
in javascript:
alert(1421974191 + ' | ' + (1421974191 << 5))
produces 1421974191 | -1741466144
I'd be grateful for any advice on why this is happening, and how I can replicate the javascript in Ruby.
Thanks in advance
Dan