\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\frac{\left|z\right| + \mathsf{hypot}\left(x, y\right)}{\frac{2}{\frac{\mathsf{hypot}\left(x, y\right)}{y} - \frac{\left|z\right|}{y}}}double code(double x, double y, double z) {
return ((((x * x) + (y * y)) - (z * z)) / (y * 2.0));
}
double code(double x, double y, double z) {
return ((fabs(z) + hypot(x, y)) / (2.0 / ((hypot(x, y) / y) - (fabs(z) / y))));
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 28.4 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 28.4
rmApplied *-un-lft-identity28.4
Applied add-sqr-sqrt28.4
Applied add-sqr-sqrt28.4
Applied difference-of-squares28.4
Applied times-frac28.3
Simplified28.3
Simplified0.1
rmApplied clear-num0.2
Applied un-div-inv0.2
Final simplification0.2
herbie shell --seed 2020066 +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)))