Average Error: 28.7 → 0.1
Time: 35.1s
Precision: 64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
\[\left(z + \mathsf{hypot}\left(x, y\right)\right) \cdot \left(\frac{1}{2 \cdot 1} \cdot \left(\frac{\mathsf{hypot}\left(x, y\right)}{y} - \frac{z}{y}\right)\right)\]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\left(z + \mathsf{hypot}\left(x, y\right)\right) \cdot \left(\frac{1}{2 \cdot 1} \cdot \left(\frac{\mathsf{hypot}\left(x, y\right)}{y} - \frac{z}{y}\right)\right)
double code(double x, double y, double z) {
	return ((double) (((double) (((double) (((double) (x * x)) + ((double) (y * y)))) - ((double) (z * z)))) / ((double) (y * 2.0))));
}
double code(double x, double y, double z) {
	return ((double) (((double) (z + ((double) hypot(x, y)))) * ((double) (((double) (1.0 / ((double) (2.0 * 1.0)))) * ((double) (((double) (((double) hypot(x, y)) / y)) - ((double) (z / y))))))));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original28.7
Target0.1
Herbie0.1
\[y \cdot 0.5 - \left(\frac{0.5}{y} \cdot \left(z + x\right)\right) \cdot \left(z - x\right)\]

Derivation

  1. Initial program 28.7

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
  2. Using strategy rm
  3. Applied *-commutative28.7

    \[\leadsto \frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{\color{blue}{2 \cdot y}}\]
  4. Applied add-sqr-sqrt28.7

    \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} - z \cdot z}{2 \cdot y}\]
  5. Applied difference-of-squares28.7

    \[\leadsto \frac{\color{blue}{\left(\sqrt{x \cdot x + y \cdot y} + z\right) \cdot \left(\sqrt{x \cdot x + y \cdot y} - z\right)}}{2 \cdot y}\]
  6. Applied times-frac27.0

    \[\leadsto \color{blue}{\frac{\sqrt{x \cdot x + y \cdot y} + z}{2} \cdot \frac{\sqrt{x \cdot x + y \cdot y} - z}{y}}\]
  7. Simplified27.0

    \[\leadsto \color{blue}{\frac{z + \mathsf{hypot}\left(x, y\right)}{2 \cdot 1}} \cdot \frac{\sqrt{x \cdot x + y \cdot y} - z}{y}\]
  8. Simplified0.1

    \[\leadsto \frac{z + \mathsf{hypot}\left(x, y\right)}{2 \cdot 1} \cdot \color{blue}{\left(\frac{\mathsf{hypot}\left(x, y\right)}{y} - \frac{z}{y}\right)}\]
  9. Using strategy rm
  10. Applied div-inv0.1

    \[\leadsto \color{blue}{\left(\left(z + \mathsf{hypot}\left(x, y\right)\right) \cdot \frac{1}{2 \cdot 1}\right)} \cdot \left(\frac{\mathsf{hypot}\left(x, y\right)}{y} - \frac{z}{y}\right)\]
  11. Applied associate-*l*0.1

    \[\leadsto \color{blue}{\left(z + \mathsf{hypot}\left(x, y\right)\right) \cdot \left(\frac{1}{2 \cdot 1} \cdot \left(\frac{\mathsf{hypot}\left(x, y\right)}{y} - \frac{z}{y}\right)\right)}\]
  12. Final simplification0.1

    \[\leadsto \left(z + \mathsf{hypot}\left(x, y\right)\right) \cdot \left(\frac{1}{2 \cdot 1} \cdot \left(\frac{\mathsf{hypot}\left(x, y\right)}{y} - \frac{z}{y}\right)\right)\]

Reproduce

herbie shell --seed 2020114 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
  :precision binary64

  :herbie-target
  (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))

  (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2)))