Forum: Ruby Math.log(2) != 0.30102999

Cc7107cb48ea5e9d6b096f4c7fdf2bb1?d=identicon&s=25 Selvag Ruby (selvag1005)
on 2014-06-18 11:22
Hi,

I've used the Math.log(2)like,
irb(main):001:0> Math.log(2)
=> 0.6931471805599453

When I'm using the scientific calculator to calculate log(2), it
produces the answer as, 0.30102999566398119521373889472449

I've realized that Math.log(2) != 0.30102999 of log(2).

Anyhow please assist me to get the value 0.30102999 for log(2) in Ruby
code.
B078cb4f4fb473c7a54d1fc36d10c70e?d=identicon&s=25 Regis d'Aubarede (raubarede)
on 2014-06-18 19:59
Selvag Ruby wrote in post #1150023:
> Hi,
>

> Anyhow please assist me to get the value 0.30102999 for log(2) in Ruby
> code.

irb(main):003:0> Math.log10(2)
=> 0.3010299956639812
Cc7107cb48ea5e9d6b096f4c7fdf2bb1?d=identicon&s=25 Selvag Ruby (selvag1005)
on 2014-06-19 07:00
Regis d'Aubarede wrote in post #1150088:
> Selvag Ruby wrote in post #1150023:
>> Hi,
>>
>
>> Anyhow please assist me to get the value 0.30102999 for log(2) in Ruby
>> code.
>
> irb(main):003:0> Math.log10(2)
> => 0.3010299956639812

Thank you for your immediate reply.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.