Doing a float division without installing additional gems?

Posted by Geo on Stack Overflow See other posts from Stack Overflow or by Geo
Published on 2010-04-20T10:29:31Z Indexed on 2010/04/20 10:33 UTC
Read the original article Hit count: 215

Filed under:
|
|

Let's say I have these two floats:

a = 50.0
b = 1048576.0
c = a/b

By printing c, I get this:

4.76837158203125e-005

Doing the division with calc.exe gives me the result 0.0000476837158203125 . Is there any way of achieving the same thing with Ruby without installing any additional gem?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about float