我不知道Ruby的早期历史,但
我有一种感觉,Math模块是在C< math.h>之后建立的.头.这是Ruby标准库中的
一个奇怪的鸭子.
但是,它是Ruby!所以你可以随时打破猴子修补!
class Float
def sqrt; Math.sqrt(self); end
def sin; Math.sin(self); end
def cos; Math.cos(self); end
def tan; Math.tan(self); end
def log10; Math.log10(self); end
end