views:

169

answers:

1

I need Math.radians() function and can not find it. Thx for help.

radians=(angle/180)* Math::PI
+1  A: 

You probably want to create a file called "mymath.rb" in the lib/ directory, and create a method in there, something like this:

require 'mathn'
def to_rad angle
  angle/180 * Math::PI
end

Or you can reopen Math and make it a module method or something... Up to you.


Edit: Or you can do what @MBO said.

Trevoke