Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Weird Double value that suppose to be 0 but isn't

jaza008
Contributor Contributor
472 Views
1 Reply
Message 1 of 2

Weird Double value that suppose to be 0 but isn't

jaza008
Contributor
Contributor

jaza008_0-1625458196282.png

this happened after I set the Beam family's parameter; Start Level Offset and End Level Offset To any value that is not zero, then I change it to zero, and what happened is in the first picture.

 

Funny enough the value seems to be random.

jaza008_1-1625458382470.png

 

0 Likes
Accepted solutions (1)
473 Views
1 Reply
Reply (1)
Message 2 of 2

jeremy_tammik
Autodesk
Autodesk
Accepted solution

Yes. Well. This is due to the imprecision associated with real numbers in digital computers.

 

The 'weird' number that you see is not really weird at all.

 

It is just a very small number written in exponential or scientific notation.

   

Real numbers in computation: 

 

https://en.wikipedia.org/wiki/Real_number#In_computation

 

Scientific notation:

 

https://en.wikipedia.org/wiki/Scientific_notation

  

Form your description, it was generated by adding an offset and subtracting it again. Both of the offsets were not represented precisely, e.g., because they were converted from metric to imperial units. The result was imprecise, almost exactly zero, but very slightly off. 

  

That is completely normal and must be taken into account whenever dealing with real numbers of a digital computer, for instance, in many operations, e.g., comparisons,  by adding some fuzz:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open