How it works
Decimal approximation
The calculator uses JavaScript's Math.pow to approximate the principal real
root. For a negative radicand with an odd root degree, it computes the root of the
absolute value and restores the negative sign (JavaScript's Math.pow alone
returns NaN for values such as (-8)^(1/3)). For example, the square root of 25
is 5. Results are floating-point approximations.
Radical simplification
When the radicand is a whole number (integer), the calculator attempts to
express the root in the simplest radical form a√b (or a∛b, etc.). It does this
by:
- Prime factorising the absolute value of the radicand.
- For each prime factor, grouping the exponents into full n‑th powers and a
remainder.
- Moving all full powers outside the radical, leaving the remainder inside.
Example: simplify the cube root of 54.
- Radicand = 54,
n = 3.
- Prime factorisation:
54 = 2¹ × 3³.
- Exponents:
2 has 1 (remainder after dividing by 3 → 1); 3 has 3 (full group → 3/3 = 1 full power).
- Outside the radical:
3^(3/3) = 3¹ = 3.
- Inside the radical:
2¹ = 2.
- Result:
3∛2 (the decimal approximation is also shown, ≈ 3.7798).
For large integers (>10¹⁰) the simplification is skipped to keep the calculator
instant.
Edge cases
- Radicand = 0 → always 0.
- Negative radicand with even root degree → no real root; an error is shown.
- Negative radicand with odd root degree → the negative sign is preserved
outside the radical (e.g.,
-∛8 simplifies to -2).
- Non‑integer radicands → only the decimal approximation is provided.