Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1 REPLY 1
SOLVED
Reply
Message 1 of 2
jaza008
299 Views, 1 Reply

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

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

 

1 REPLY 1
Message 2 of 2
jeremy_tammik
in reply to: jaza008

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community