Decimal to Fraction
Tape-measure math: round a decimal inches value to the nearest 1/8, 1/16, 1/32, or 1/64.
Example
You enter
- Value (in) 2.375
- Round to 16
You get
- Whole (in) 2
- Numerator 3
- Reduced denominator 8
- Decimal value (in) 2.375
- Rounding error 0
Checked against published worked examples from: Engineering ToolBox.
Details, formula, and sources
ScopeReduce the fraction to lowest terms, break it into feet-inches, and report the rounding error (first-principles arithmetic).
Formula or tableticks = round(value * den); whole = floor(ticks/den); fraction = (ticks - whole*den)/den reduced by GCD; feet = floor(whole/12); error = rounded - exact.
Source and editionDecimal-to-fraction tape-measure math - nearest 1/N rounding, GCD reduction, and feet-inch decomposition; first-principles arithmetic, public domain.
Free accessPure arithmetic, public; binary (power-of-two) denominators are the tape-measure / machinist-scale standard.
What governsEstimate. AHJ and licensed professional govern.
API field namesvalue_in, denominator, whole_in, numerator, reduced_denominator, decimal_value_in, error_in
- Binary denominators rounds to a power-of-two tape-measure fraction (2/4/8/16/32/64)tape-measure / machinist scale convention