Average Error: 22.0 → 0.3
Time: 5.1s
Precision: 64
$\frac{y \cdot y}{x \cdot x}$
$\left|\frac{y}{x}\right| \cdot \left|\frac{y}{x}\right|$
\frac{y \cdot y}{x \cdot x}
\left|\frac{y}{x}\right| \cdot \left|\frac{y}{x}\right|
double f(double y, double x) {
double r2256607 = y;
double r2256608 = r2256607 * r2256607;
double r2256609 = x;
double r2256610 = r2256609 * r2256609;
double r2256611 = r2256608 / r2256610;
return r2256611;
}

double f(double y, double x) {
double r2256612 = y;
double r2256613 = x;
double r2256614 = r2256612 / r2256613;
double r2256615 = fabs(r2256614);
double r2256616 = r2256615 * r2256615;
return r2256616;
}

# Try it out

Your Program's Arguments

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 22.0

$\frac{y \cdot y}{x \cdot x}$
2. Using strategy rm
3. Applied add-sqr-sqrt22.1

$\leadsto \color{blue}{\sqrt{\frac{y \cdot y}{x \cdot x}} \cdot \sqrt{\frac{y \cdot y}{x \cdot x}}}$
4. Simplified22.0

$\leadsto \color{blue}{\left|\frac{y}{x}\right|} \cdot \sqrt{\frac{y \cdot y}{x \cdot x}}$
5. Simplified0.3

$\leadsto \left|\frac{y}{x}\right| \cdot \color{blue}{\left|\frac{y}{x}\right|}$
6. Final simplification0.3

$\leadsto \left|\frac{y}{x}\right| \cdot \left|\frac{y}{x}\right|$

# Reproduce

herbie shell --seed 1
(FPCore (y x)
:name " (y * y) / (x * x)"
:precision binary64
(/ (* y y) (* x x)))