# Rounding problem in summing up to numbers

**URL:** <https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [December 8, 2016, 9:43pm UTC](https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815 "2016-12-08T21:43:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aleksandr\_Mikheev](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@Aleksandr\_Mikheev](https://discourse.julialang.org/u/Aleksandr_Mikheev)\
**Post date:** [December 8, 2016, 9:43pm UTC](https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815/1 "2016-12-08T21:43:42Z")

</div>

Hello, I have a really silly question. When I sum up to float numbers

```julia
12.5 + 0.00640

```

I have the same result

```julia
12.5

```

I have never had such problem before. I thought the problem is with the way the number printed on the screen, but even

```julia
BigFloat(12.5 + 0.00640)

```

gives the same.

I mean, 0.00640 is way bigger than machine epsilon for Float64. What could be the problem?

Thank you in advance

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [December 8, 2016, 9:46pm UTC](https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815/2 "2016-12-08T21:46:38Z")

</div>

I can’t reproduce this:

```julia
julia> 12.5 + 0.00640
12.5064

```

---

<div class="post-metadata">

**Author:** ![Aleksandr\_Mikheev](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@Aleksandr\_Mikheev](https://discourse.julialang.org/u/Aleksandr_Mikheev)\
**Post date:** [December 8, 2016, 9:49pm UTC](https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815/3 "2016-12-08T21:49:55Z")

</div>

The weird part is that I just tried to do this in console, and everything worked fine. But with using Juno’s console the problem still remains (I tried to rerun). What could be wrong?

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [December 8, 2016, 9:54pm UTC](https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815/4 "2016-12-08T21:54:43Z")

</div>

Juno seems to aggressively truncate the printing of floating-point values:

![](https://global.discourse-cdn.com/julialang/original/3X/8/1/81445d981434c941c91707328f5c382ce3ac6454.png)

This should be fixed. Would you mind filing an issue on the [Juno repository](https://github.com/JunoLab/Juno.jl/issues) and linking to this thread?

---

<div class="post-metadata">

**Author:** ![Aleksandr\_Mikheev](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@Aleksandr\_Mikheev](https://discourse.julialang.org/u/Aleksandr_Mikheev)\
**Post date:** [December 8, 2016, 10:03pm UTC](https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815/5 "2016-12-08T22:03:07Z")

</div>

Not sure if i did this correctly, but [here](https://github.com/JunoLab/Juno.jl/issues/27) it is. Thank you for your help!

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 8, 2016, 10:20pm UTC](https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815/6 "2016-12-08T22:20:07Z")

</div>

Just click on it. Like arrays, things which are rendered via Juno.jl can be interactive. This is nice because then it can show a simplified form, but the more in-depth form is right there as well. Maybe there should be an indicator that numbers are clickable.

Before:

![](https://global.discourse-cdn.com/julialang/original/3X/2/5/251bf81b3d45e4e6481b1fdfaf96a6f086ba227a.png)

After:

![](https://global.discourse-cdn.com/julialang/original/3X/6/e/6eb8fd7cae7b99f4ae568eacb3451118267d645a.png)

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 8, 2016, 10:29pm UTC](https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815/7 "2016-12-08T22:29:56Z")

</div>

But this question has come up quite often. Maybe this should be in the Juno documentation in the FAQ section?

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [December 8, 2016, 11:48pm UTC](https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815/8 "2016-12-08T23:48:19Z")

</div>

I don’t really want my environment to elide a value unless it’s pressed for space. When we elide arrays we print dots. An elided number could end in an ellipsis.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [December 8, 2016, 11:49pm UTC](https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815/9 "2016-12-08T23:49:17Z")

</div>

Also, I’m pretty sure I tried clicking on both the number and the arrow to its left and nothing happened since I thought that might be how this worked.

EDIT: I tried again and I must have only tried clicking the arrow on the left, not the number itself – clicking the number does expand it, but it’s pretty hard to discover this.

---

<div class="post-metadata">

**Author:** ![Aaron1488](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Aaron1488](https://discourse.julialang.org/u/Aaron1488)\
**Post date:** [February 20, 2017, 8:37am UTC](https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815/10 "2017-02-20T08:37:11Z")

</div>

Was this issue resolved? My Juno rounds all numbers to 2 or 3 digits. Is it possible to set global rounding to some number of digits (something like options(“scipen”=100, “digits”=5) in R)?

---

<div class="post-metadata">

**Author:** ![Balinus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/balinus/32/243_2.png) [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Post date:** [February 23, 2017, 2:09pm UTC](https://discourse.julialang.org/t/rounding-problem-in-summing-up-to-numbers/815/11 "2017-02-23T14:09:14Z")

</div>

Well, there is now 3 dots after the number, indicating that the number is not shown in whole.

An option to set our preference would be great.
