# Working with machine precision

**URL:** <https://discourse.julialang.org/t/working-with-machine-precision/29576>\
**Category:** General Usage\
**Created:** [October 7, 2019, 7:49am UTC](https://discourse.julialang.org/t/working-with-machine-precision/29576 "2019-10-07T07:49:35Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [October 7, 2019, 12:13pm UTC](https://discourse.julialang.org/t/working-with-machine-precision/29576/9 "2019-10-07T12:13:51Z")

</div>

Have you seen [http://0.30000000000000004.com/](http://0.30000000000000004.com/)?

> [@aahaselgrove](#):
>
> Eg. (in C, what I would expect)

That seems to print 2.9999999999999999e-01 (which Julia also does with `@printf`):

```julia
julia> using Printf

julia> @printf "%1.16e\n" .3
2.9999999999999999e-01

```

Anyway, Julia uses the GRISU (or Ryu) algorithm to print the float. It guarantees that the generated strings can be parsed back to the original number while minimizing the number of digits.

And indeed:

```julia
julia> 2.9999999999999999e-01
0.3

julia> 0.3
0.3

```

so printing `0.3` is shorter here and thus preferable. But in the original example, `0.3` and `0.30000000000000004` are different floating point numbers and it would thus be an error to print `0.3` since it doesn’t parse back to the original number.

---

_[View the full topic](https://discourse.julialang.org/t/working-with-machine-precision/29576)._
