# Floating types in Julia

**URL:** <https://discourse.julialang.org/t/floating-types-in-julia/13873>\
**Category:** General Usage\
**Created:** [August 22, 2018, 8:10am UTC](https://discourse.julialang.org/t/floating-types-in-julia/13873 "2018-08-22T08:10:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![microlifecc](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@microlifecc](https://discourse.julialang.org/u/microlifecc)\
**Post date:** [August 22, 2018, 8:10am UTC](https://discourse.julialang.org/t/floating-types-in-julia/13873/1 "2018-08-22T08:10:23Z")

</div>

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](https://stackoverflow.com/questions/51961847/floating-types-in-julia) as well!

---

<div class="post-metadata">

**Author:** ![visr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/visr/32/17204_2.png) [@visr](https://discourse.julialang.org/u/visr)\
**Post date:** [August 22, 2018, 8:13am UTC](https://discourse.julialang.org/t/floating-types-in-julia/13873/2 "2018-08-22T08:13:39Z")

</div>

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.
