\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\begin{array}{l}
\mathbf{if}\;x \leq -2.606579495399084 \cdot 10^{+208}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \leq -4.11761413583795 \cdot 10^{+154}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{elif}\;x \leq -2.01574423849711:\\
\;\;\;\;-1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{\left(y - z\right) + 1}}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
(FPCore (x y z)
:precision binary64
(if (<= x -2.606579495399084e+208)
(* -1.0 x)
(if (<= x -4.11761413583795e+154)
(/ (* y x) z)
(if (<= x -2.01574423849711) (* -1.0 x) (/ x (/ z (+ (- y z) 1.0)))))))double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
double code(double x, double y, double z) {
double tmp;
if (x <= -2.606579495399084e+208) {
tmp = -1.0 * x;
} else if (x <= -4.11761413583795e+154) {
tmp = (y * x) / z;
} else if (x <= -2.01574423849711) {
tmp = -1.0 * x;
} else {
tmp = x / (z / ((y - z) + 1.0));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 10.0 |
|---|---|
| Target | 0.5 |
| Herbie | 9.3 |
if x < -2.606579495399084e208 or -4.11761413583794979e154 < x < -2.0157442384971098Initial program 24.1
Taylor expanded in z around inf 26.8
if -2.606579495399084e208 < x < -4.11761413583794979e154Initial program 32.0
Taylor expanded in y around inf 58.0
if -2.0157442384971098 < x Initial program 6.3
Applied egg-rr11.0
Applied egg-rr3.9
Final simplification9.3
herbie shell --seed 2022127
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< x -2.71483106713436e-162) (- (* (+ 1.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))
(/ (* x (+ (- y z) 1.0)) z))