\frac{x + y \cdot \left(z - x\right)}{z}\begin{array}{l}
\mathbf{if}\;z \leq -1.1547986762301652 \cdot 10^{+37} \lor \neg \left(z \leq 1.6128080895465512 \cdot 10^{+100}\right):\\
\;\;\;\;y + x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x - y \cdot x}{z}\\
\end{array}double code(double x, double y, double z) {
return (((double) (x + ((double) (y * ((double) (z - x)))))) / z);
}
double code(double x, double y, double z) {
double VAR;
if (((z <= -1.1547986762301652e+37) || !(z <= 1.6128080895465512e+100))) {
VAR = ((double) (y + ((double) (x * (((double) (1.0 - y)) / z)))));
} else {
VAR = ((double) (y + (((double) (x - ((double) (y * x)))) / z)));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 10.6 |
|---|---|
| Target | 0.0 |
| Herbie | 0.3 |
if z < -1.15479867623016523e37 or 1.6128080895465512e100 < z Initial program 20.1
Simplified0.1
if -1.15479867623016523e37 < z < 1.6128080895465512e100Initial program 1.4
Simplified6.7
rmApplied associate-*r/0.5
Simplified0.5
Final simplification0.3
herbie shell --seed 2020199
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:herbie-target
(- (+ y (/ x z)) (/ y (/ z x)))
(/ (+ x (* y (- z x))) z))