From: oinkoink+unet@... (Bret Jolly) Date: 2003-03-21T10:00:09+09:00 Subject: Re: Newbie question: 9/5=1 ? Thomas Jollans wrote in message news:... > while learning ruby i wanted to program a simple fahrenheit to celsius > converter. for that i need 9/5 to be 1,8 (and not 1). how do i do that > in ruby? One way is to require the 'mathn' standard library. irb(main):001:0> require 'mathn' true irb(main):002:0> f = 63 63 irb(main):003:0> c = (5/9)*(f - 32) 155/9 irb(main):004:0> c.to_f 17.22222222 'mathn' gives you rationals, complex numbers, and matrices, and allows a more natural notation for rationals than the 'rational' library does (so 5/9 is the rational number five-ninths). I always require mathn! Regards, Bret Bret Jolly (Jou Lii Bair) http://www.rexx.com/~oinkoink/