Floating types in Julia

I have a constant value:

M_LN2 = 0.693147180559945309417

I tried storing it as:

M_LN2 = BigFloat(0.693147180559945309417)

The result seems to be adding too many extra digits:

6.931471805599452862267639829951804131269454956054687500000000000000000000000000e-01

I tried:

M_LN2 = Float64(0.693147180559945309417)

But it is truncating the value:

0.6931471805599453

Could you suggest what would be the correct way to initialize the constant?
Thanks!

I have posted the question here as well!

It appears your question is answered already on StackOverflow. It’s best to avoid asking the same question at the same time on two different forums, though luckily you posted a link so I could see it’s been answered.

2 Likes