Precision Issues with Feet and Inches in Rhino and Grasshopper

I’m encountering a precision issue when using Rhino and Grasshopper to perform unit conversions and calculations involving feet and inches.

The Problem:

When converting inches to decimal feet and then performing operations, I’m not getting the expected precision in results. Specifically:

  • Example Calculation:
    • Starting with: 0.083333333333333 (should represent 1 inch as a decimal of a foot)
    • Operation: Multiply by 2 (should result in 0.166666666666667)
    • Operation: Multiply back by 12 to convert to inches (should result in exactly 2 inches)

Instead, I’m getting a result close to 1.999992 rather than exactly 2, indicating a loss of precision.

What I’ve Tried:

  1. Adjusting Rhino’s Document Settings:
  • Went to File > Properties > Units
  • Increased Number of Decimal Places to 15 or more.
  1. Using Grasshopper:
  • Used Expression components for precise calculation steps: x / 12, x * 2, and x * 12.
  • Configured Panel components to display more decimal places for verification.

Despite these adjustments, the precision issue persists.

My Setup:

  • Software Versions:
    • Rhino: [Specify version, e.g., Rhino 7]
    • Grasshopper:

Request:

Has anyone else experienced similar issues with precision in Rhino and Grasshopper? If so, how did you resolve them? Are there any additional settings or best practices I might be overlooking?

Thank you for your assistance!
Unit Precision Issues with Feet and Inches.gh (12.8 KB)

It’s not a Rhino or Grasshopper thing, it’s that computers are REALLY bad at fractions:

Cheers

DK, from the modern world, where we use mm and live much happier lives, but still have problems with decimals in binary…

1 Like

Hi
thanks for sharing the video
well explained

1 Like


Why i m getting different results in the same thing

You are not doing the same thing in the two definitions. In the first one you are using data that has passed through a panel. There text conversion happens with rounding.

You should never pipe data through a panel and use the panel output. You are not guaranteed to be working with correct data.

In short: Do Not Pipe Data Through Panel.

1 Like

thanks