Rounding problem in summing up to numbers

question

#1

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

12.5 + 0.00640

I have the same result

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

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


#2

I can’t reproduce this:

julia> 12.5 + 0.00640
12.5064

#3

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?


#4

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

This should be fixed. Would you mind filing an issue on the Juno repository and linking to this thread?


#5

Not sure if i did this correctly, but here it is. Thank you for your help!


#6

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:

After:


#7

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


#8

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.


#9

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.


#10

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)?


#11

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.