Average Error: 28.8 → 0.2
Time: 3.2s
Precision: binary64
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
\[0.5 \cdot \left(\left(y + x \cdot \frac{x}{y}\right) - z \cdot \frac{z}{y}\right)\]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
0.5 \cdot \left(\left(y + x \cdot \frac{x}{y}\right) - z \cdot \frac{z}{y}\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) (0.5 * ((double) (((double) (y + ((double) (x * ((double) (x / y)))))) - ((double) (z * ((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.8
Target0.2
Herbie0.2
\[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.8

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\]
  2. Taylor expanded around 0 12.7

    \[\leadsto \color{blue}{\left(0.5 \cdot y + 0.5 \cdot \frac{{x}^{2}}{y}\right) - 0.5 \cdot \frac{{z}^{2}}{y}}\]
  3. Simplified12.7

    \[\leadsto \color{blue}{0.5 \cdot \left(\left(y + \frac{{x}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)}\]
  4. Using strategy rm
  5. Applied *-un-lft-identity12.7

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{{x}^{2}}{\color{blue}{1 \cdot y}}\right) - \frac{{z}^{2}}{y}\right)\]
  6. Applied add-sqr-sqrt38.8

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{{\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{2}}{1 \cdot y}\right) - \frac{{z}^{2}}{y}\right)\]
  7. Applied unpow-prod-down38.8

    \[\leadsto 0.5 \cdot \left(\left(y + \frac{\color{blue}{{\left(\sqrt{x}\right)}^{2} \cdot {\left(\sqrt{x}\right)}^{2}}}{1 \cdot y}\right) - \frac{{z}^{2}}{y}\right)\]
  8. Applied times-frac35.9

    \[\leadsto 0.5 \cdot \left(\left(y + \color{blue}{\frac{{\left(\sqrt{x}\right)}^{2}}{1} \cdot \frac{{\left(\sqrt{x}\right)}^{2}}{y}}\right) - \frac{{z}^{2}}{y}\right)\]
  9. Simplified35.9

    \[\leadsto 0.5 \cdot \left(\left(y + \color{blue}{x} \cdot \frac{{\left(\sqrt{x}\right)}^{2}}{y}\right) - \frac{{z}^{2}}{y}\right)\]
  10. Simplified6.8

    \[\leadsto 0.5 \cdot \left(\left(y + x \cdot \color{blue}{\frac{x}{y}}\right) - \frac{{z}^{2}}{y}\right)\]
  11. Using strategy rm
  12. Applied *-un-lft-identity6.8

    \[\leadsto 0.5 \cdot \left(\left(y + x \cdot \frac{x}{y}\right) - \frac{{z}^{2}}{\color{blue}{1 \cdot y}}\right)\]
  13. Applied add-sqr-sqrt35.0

    \[\leadsto 0.5 \cdot \left(\left(y + x \cdot \frac{x}{y}\right) - \frac{{\color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)}}^{2}}{1 \cdot y}\right)\]
  14. Applied unpow-prod-down35.0

    \[\leadsto 0.5 \cdot \left(\left(y + x \cdot \frac{x}{y}\right) - \frac{\color{blue}{{\left(\sqrt{z}\right)}^{2} \cdot {\left(\sqrt{z}\right)}^{2}}}{1 \cdot y}\right)\]
  15. Applied times-frac31.6

    \[\leadsto 0.5 \cdot \left(\left(y + x \cdot \frac{x}{y}\right) - \color{blue}{\frac{{\left(\sqrt{z}\right)}^{2}}{1} \cdot \frac{{\left(\sqrt{z}\right)}^{2}}{y}}\right)\]
  16. Simplified31.5

    \[\leadsto 0.5 \cdot \left(\left(y + x \cdot \frac{x}{y}\right) - \color{blue}{z} \cdot \frac{{\left(\sqrt{z}\right)}^{2}}{y}\right)\]
  17. Simplified0.2

    \[\leadsto 0.5 \cdot \left(\left(y + x \cdot \frac{x}{y}\right) - z \cdot \color{blue}{\frac{z}{y}}\right)\]
  18. Final simplification0.2

    \[\leadsto 0.5 \cdot \left(\left(y + x \cdot \frac{x}{y}\right) - z \cdot \frac{z}{y}\right)\]

Reproduce

herbie shell --seed 2020150 
(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.0)))