\frac{x + y \cdot \left(z - x\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.8656980950261925 \cdot 10^{136} \lor \neg \left(z \le 4.22146914678880335 \cdot 10^{-44}\right):\\
\;\;\;\;\left(\frac{x}{z} + y\right) - x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{z} + y\right) - \frac{x \cdot y}{z}\\
\end{array}double code(double x, double y, double z) {
return ((double) (((double) (x + ((double) (y * ((double) (z - x)))))) / z));
}
double code(double x, double y, double z) {
double VAR;
if (((z <= -1.8656980950261925e+136) || !(z <= 4.2214691467888034e-44))) {
VAR = ((double) (((double) (((double) (x / z)) + y)) - ((double) (x * ((double) (y / z))))));
} else {
VAR = ((double) (((double) (((double) (x / z)) + y)) - ((double) (((double) (x * y)) / z))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 10.3 |
|---|---|
| Target | 0.0 |
| Herbie | 0.4 |
if z < -1.8656980950261925e136 or 4.22146914678880335e-44 < z Initial program 17.7
Taylor expanded around 0 5.4
rmApplied *-un-lft-identity5.4
Applied times-frac0.2
Simplified0.2
if -1.8656980950261925e136 < z < 4.22146914678880335e-44Initial program 2.3
Taylor expanded around 0 0.8
Final simplification0.4
herbie shell --seed 2020161
(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))