Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
rhino:floating_point_faq [2025/04/03]
maryfugier created
rhino:floating_point_faq [2025/04/03] (current)
maryfugier
Line 1: Line 1:
 ======Floating Point Issues in Rhino======  ======Floating Point Issues in Rhino====== 
  
-===== Background =====+==== Background ====
  
 When you model is located far from the world origin, or you are using a unit that is too small for the physical size object you are modeling, then floating point issues can appear. When you model is located far from the world origin, or you are using a unit that is too small for the physical size object you are modeling, then floating point issues can appear.
Line 11: Line 11:
 **In general, modeling a very large distance from the origin can cause problems and should be avoided.** **In general, modeling a very large distance from the origin can cause problems and should be avoided.**
  
-===== Double-precision Floating-point Number=====+==== Double-precision Floating-point Number====
  
 Rhino, like most CAD products, represents position in **double-precision floating-point numbers**. That means the x‑, y‑, or z-coordinate of any point can have a value ranging from as large as ±10308 to as small as ±10-308.  Rhino, like most CAD products, represents position in **double-precision floating-point numbers**. That means the x‑, y‑, or z-coordinate of any point can have a value ranging from as large as ±10308 to as small as ±10-308. 
Line 24: Line 24:
  
  
-===== Best Practices =====+==== Best Practices ====
 Make2D and Clipping drawing rely on Rhino being able to calculate accurate intersections. If the intersections are “round off”, then the outcomes of these commands will look inaccurate. To get the accuracy desired, you need to: Make2D and Clipping drawing rely on Rhino being able to calculate accurate intersections. If the intersections are “round off”, then the outcomes of these commands will look inaccurate. To get the accuracy desired, you need to:
  
Line 30: Line 30:
   * And model close to the origin.   * And model close to the origin.
  
-The is the best approach to create metric architectural models in reasonable unit like Meters and **only dimension in mm**.+The is the best approach to create metric architectural models in reasonable unit like **Meters** and **only dimension in mm**.  
 +While mm entirely is the correct choice for a small object like jewelry. For architecture where the objects are 10,000 or more times larger, a unit like Meters is a much better choice for precise calculations.
  
   - Begin a new model with Meters Small template (this will give you .001 meters precision, you can increase it to .0001 but it you go beyond that, you will start to see round off errors.)   - Begin a new model with Meters Small template (this will give you .001 meters precision, you can increase it to .0001 but it you go beyond that, you will start to see round off errors.)
Line 36: Line 37:
   - Dimension in MM only   - Dimension in MM only
   - There is an override on the Dimension to display the dimension in a unit/precision other than the Model unit.   - There is an override on the Dimension to display the dimension in a unit/precision other than the Model unit.
 +    {{:rhino:dim_in_mm.png?400|}}
 +
 +===== More Information =====
 +
 +CAD users should understand that floating-point numbers are approximations of real numbers, not exact representations, and can lead to rounding errors, especially when performing complex calculations or comparing values.
 + 
 +==== Floating-Point Representation: ====
 +
 +Computers represent numbers using a limited number of bits, which means they can't store all real numbers with perfect accuracy. This is particularly relevant for numbers with decimal parts, as many decimal values don't have a precise binary representation. 
 +
 +==== Rounding Errors: ====
 +
 +When performing calculations, floating-point operations often result in numbers that are slightly off from the true value due to rounding. These errors can accumulate over multiple calculations, leading to inaccuracies in the final results. 
 +
 +==== IEEE 754 Standard: ====
 +
 +Most modern computers use the IEEE 754 standard for floating-point arithmetic, which defines how numbers are represented and how operations are performed. 
 +
 +==== Implications for CAD: ====
 +
 +  * Geometric Accuracy: In CAD, precise geometric calculations are crucial. Rounding errors can lead to discrepancies in dimensions, angles, and other geometric properties, potentially impacting the accuracy of designs.
 +  * Comparisons: Directly comparing floating-point numbers for equality can be problematic because of rounding errors. Instead, consider using a small tolerance or epsilon value when comparing floating-point numbers.
 +  * Tolerance Settings: CAD software often uses tolerance settings to account for the inherent limitations of floating-point arithmetic. Understanding these settings and their impact on design accuracy is important.
 +  * Data Exchange: When exchanging CAD data between different systems, floating-point representations can vary, potentially leading to discrepancies in dimensions or other parameters. 
 +
 +==== Example: ====
 +
 +The decimal number 0.1 cannot be represented exactly in binary with a finite number of digits, so it's stored as a close approximation, and the difference between the stored value and the actual value can cause problems. 
 +
 +==== Mitigation: ====
 +
 +  * Work around the world origin: For applications where precise calculations are critical, consider modeling your geometry around the world origin (0,0,0) whenever possible. 
 +  * Be Aware of Rounding Errors: Be mindful of the potential for rounding errors and their impact on the accuracy of your designs. 
 +  * Use Appropriate Tolerances: Set appropriate tolerance values in your CAD software to account for the limitations of floating-point arithmetic. 
  
 ===== Resources===== ===== Resources=====
Line 41: Line 76:
   * [[https://www.rhino3d.com/features/accuracy/|Accuracy in Rhino]]   * [[https://www.rhino3d.com/features/accuracy/|Accuracy in Rhino]]
   * Discourse Topic: [[https://discourse.mcneel.com/t/architectural-modeling-precision-floating-point-make2d-tolerances-etc/48412 |architectural-modeling-precision-floating-point-make2d-tolerances-etc]]   * Discourse Topic: [[https://discourse.mcneel.com/t/architectural-modeling-precision-floating-point-make2d-tolerances-etc/48412 |architectural-modeling-precision-floating-point-make2d-tolerances-etc]]
 +  * 
 + Question? Email tech@mcneel.com Attn. Mary. Include a small file and your Rhino SystemInfo.
  
  
rhino/floating_point_faq.1743700297.txt.gz · Last modified: 2025/04/03 by maryfugier