Average Error: 33.6 → 0.4
Time: 8.3s
Precision: binary64
\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
\[\frac{z}{t} \cdot \frac{z}{t} + \frac{x}{y} \cdot \frac{x}{y} \]
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\frac{z}{t} \cdot \frac{z}{t} + \frac{x}{y} \cdot \frac{x}{y}
(FPCore (x y z t)
 :precision binary64
 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
(FPCore (x y z t)
 :precision binary64
 (+ (* (/ z t) (/ z t)) (* (/ x y) (/ x y))))
double code(double x, double y, double z, double t) {
	return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
double code(double x, double y, double z, double t) {
	return ((z / t) * (z / t)) + ((x / y) * (x / y));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original33.6
Target0.4
Herbie0.4
\[{\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2} \]

Derivation

  1. Initial program 33.6

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Simplified29.5

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right)} \]
  3. Applied add-sqr-sqrt_binary6429.6

    \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right)} \cdot \sqrt{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right)}} \]
  4. Simplified29.5

    \[\leadsto \color{blue}{\mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right)} \cdot \sqrt{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right)} \]
  5. Simplified0.4

    \[\leadsto \mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right) \cdot \color{blue}{\mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right)} \]
  6. Applied hypot-udef_binary640.4

    \[\leadsto \mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right) \cdot \color{blue}{\sqrt{\frac{z}{t} \cdot \frac{z}{t} + \frac{x}{y} \cdot \frac{x}{y}}} \]
  7. Applied hypot-udef_binary640.4

    \[\leadsto \color{blue}{\sqrt{\frac{z}{t} \cdot \frac{z}{t} + \frac{x}{y} \cdot \frac{x}{y}}} \cdot \sqrt{\frac{z}{t} \cdot \frac{z}{t} + \frac{x}{y} \cdot \frac{x}{y}} \]
  8. Applied rem-square-sqrt_binary640.4

    \[\leadsto \color{blue}{\frac{z}{t} \cdot \frac{z}{t} + \frac{x}{y} \cdot \frac{x}{y}} \]
  9. Final simplification0.4

    \[\leadsto \frac{z}{t} \cdot \frac{z}{t} + \frac{x}{y} \cdot \frac{x}{y} \]

Reproduce

herbie shell --seed 2021344 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1"
  :precision binary64

  :herbie-target
  (+ (pow (/ x y) 2.0) (pow (/ z t) 2.0))

  (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))