Decimal to Fraction

Tape-measure math: round a decimal inches value to the nearest 1/8, 1/16, 1/32, or 1/64.

Run the calculator

Example

You enter

You get

Details, formula, and sources

Reduce the fraction to lowest terms, break it into feet-inches, and report the rounding error (first-principles arithmetic).

ticks = round(value * den); whole = floor(ticks/den); fraction = (ticks - whole*den)/den reduced by GCD; feet = floor(whole/12); error = rounded - exact.

Decimal-to-fraction tape-measure math - nearest 1/N rounding, GCD reduction, and feet-inch decomposition; first-principles arithmetic, public domain.

Pure arithmetic, public; binary (power-of-two) denominators are the tape-measure / machinist-scale standard.

Estimate. AHJ and licensed professional govern.

Field names used by the API: value_in, denominator, whole_in, numerator, reduced_denominator, decimal_value_in, error_in

Related tools