Phil Cooper-king wrote:
> any further 1.0.to_i works

You're experiencing IEEE Floating point aritmetic. Look at this example:
---------------------------------------
ruby -v: ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux]
irb(main):001:0> x = -1
=> -1
irb(main):002:0> y = -1
=> -1
irb(main):003:0> angle = 90 * Math::PI / 180
=> 1.5707963267949
irb(main):004:0> n_x = (Math::cos(angle) * x) - (Math::sin(angle) * y)
=> 1.0
irb(main):005:0> sprintf("%.50f", n_x)
=> "0.99999999999999988897769753748434595763683319091797"
irb(main):006:0> n_x.to_i
=> 0
irb(main):007:0> n_x.round
=> 1
irb(main):008:0> sprintf("%.50f", 1.0)
=> "1.00000000000000000000000000000000000000000000000000"
irb(main):009:0>
---------------------------------------
Your result isn't that exactly 1 as you think.

Marvin
-- 
Posted via http://www.ruby-forum.com/.