Proportion Calculator / The details

Calculation methodology

The method should be visible, repeatable, and open to checking.

Proportion calculation

The equation is A/B = C/D, with B ≠ 0 and D ≠ 0. Multiplication by B × D gives A × D = B × C. Exactly one input must be blank. The tool rearranges this equation to isolate that position.

  • A = B × C / D
  • B = A × D / C
  • C = A × D / B
  • D = B × C / A

A known denominator of zero is rejected before solving. If an unknown denominator would be zero, there is no valid solution. A zero coefficient and zero cross product mean any nonzero denominator works; a zero coefficient with a nonzero cross product means no solution. The final exact cross products are compared for every unique result.

Slope calculation

Rise = y₂ − y₁ and run = x₂ − x₁. For nonzero run, m = rise/run. Zero rise and nonzero run give a horizontal line. Zero run and nonzero rise give a vertical line with undefined slope. Zero rise and zero run indicate identical points and an indeterminate slope.

Exact values and rounded displays

Decimal and scientific-notation strings are converted to integer fractions using JavaScript BigInt. Fractions are reduced by their greatest common divisor after each operation. This avoids binary floating-point rounding in the calculation itself.

The main display uses at most 12 significant figures, rounded halfway away from zero. Very small values below 0.000001 and values at least 10¹⁵ use scientific notation. Rounded values carry an ≈ sign; the reduced exact fraction is also shown. An exact calculation of entered numbers does not make the original measurements exact.

Accepted input and limits

Inputs accept a sign, decimal point, and optional base-10 exponent, such as −0.25 or 2.5e8. Use up to 80 digits before and after the decimal point combined; a leading decimal point counts as an implicit zero. Exponents must be between −300 and 300. Text fields are capped at 400 characters. Fractions with a slash, comma separators, NaN, Infinity, and units are rejected. These limits bound computation and make errors predictable.

Verification and limitations

Automated checks cover all four unknown positions, zero and negative values, decimal inputs, large values, rounding, degenerate equations, and slope line types. Browser checks exercise input, reset, copy, sample loading, and accessibility. Testing cannot establish correctness for every conceivable use.

The tools do not choose real-world models, validate measurements, or provide professional engineering, financial, legal, or scientific advice. For decisions where an error could cause harm, independently verify the method and result with an appropriately qualified person.