x + \frac{y \cdot \left(z - x\right)}{t}\begin{array}{l}
\mathbf{if}\;y \le -1.62456598796659967 \cdot 10^{-44} \lor \neg \left(y \le 1.0561959963379154 \cdot 10^{-168}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t} + x\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \left(\frac{y}{\sqrt[3]{t}} \cdot \left(z - x\right)\right) + x\\
\end{array}double code(double x, double y, double z, double t) {
return (x + ((y * (z - x)) / t));
}
double code(double x, double y, double z, double t) {
double temp;
if (((y <= -1.6245659879665997e-44) || !(y <= 1.0561959963379154e-168))) {
temp = ((y * ((z - x) / t)) + x);
} else {
temp = (((1.0 / (cbrt(t) * cbrt(t))) * ((y / cbrt(t)) * (z - x))) + x);
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.6 |
|---|---|
| Target | 2.1 |
| Herbie | 2.2 |
if y < -1.6245659879665997e-44 or 1.0561959963379154e-168 < y Initial program 10.3
Simplified2.8
rmApplied fma-udef2.8
rmApplied div-inv2.8
Applied associate-*l*3.1
Simplified3.1
if -1.6245659879665997e-44 < y < 1.0561959963379154e-168Initial program 1.4
Simplified1.2
rmApplied fma-udef1.2
rmApplied add-cube-cbrt1.5
Applied *-un-lft-identity1.5
Applied times-frac1.5
Applied associate-*l*1.0
Final simplification2.2
herbie shell --seed 2020049 +o rules:numerics
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))