I’m having an issue with a float being converted to an int,

The maths is part of a vector rotation of a little video game, which x,y

coords are rotated at a given angle.

For what ever reason the first instance gives an error, and every

instance there after works as it should

This cant be right?

ruby 1.8.7

[irb]

# This works the way I would think

1.0.o_i

=> 1

# This doesn’t

x = -1

y = -1

angle = 90 * Math::PI / 180

n_x = (Math::cos(angle) * x) - (Math::sin(angle) * y)

=> 1.0

# this is where its werid

n_x.to_i

=> 0

[/irb]

any further 1.0.to_i works