Does Length Precision Round or Truncate Values?


If I set a value with a float value with more decimal places than the LengthPrecision is set to what happens? Is the float value rounded, truncated, or other?


The Units > LengthPrecision apply to the display of numbers in the UI dialogs, and to the values in text callouts and dimensions.

Under the hood, in Ruby, Length and Float are two different (but related Numeric classes.)

In the past under Ruby 1.8, there was a way to fool the interpreter into having Length be a subclass of Float. But now with Ruby 2.0 that is not possible. Length is a direct subclass of Numeric, so now a sibling of Float.

So, to your question. When you create objects of these classes, they are separate objects. You need to do class conversion using #to_l and #to_f methods when you want a new object of the other class.

Likewise, to you need to specifically call the object’s #round and #truncate methods to create new rounded and integer objects (respectively.)