\frac{x + y \cdot \left(z - x\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -7.40183324643559959 \cdot 10^{-155} \lor \neg \left(z \le 1.24573566825068198 \cdot 10^{-98}\right):\\
\;\;\;\;\left(\frac{x}{z} + y\right) - x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y \cdot \left(z - x\right)\right) \cdot \frac{1}{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 <= -7.4018332464356e-155) || !(z <= 1.245735668250682e-98))) {
VAR = ((double) (((double) (((double) (x / z)) + y)) - ((double) (x * ((double) (y / z))))));
} else {
VAR = ((double) (((double) (x + ((double) (y * ((double) (z - x)))))) * ((double) (1.0 / z))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 10.1 |
|---|---|
| Target | 0.0 |
| Herbie | 0.8 |
if z < -7.40183324643559959e-155 or 1.24573566825068198e-98 < z Initial program 12.6
Taylor expanded around 0 4.1
rmApplied *-un-lft-identity4.1
Applied times-frac0.9
Simplified0.9
if -7.40183324643559959e-155 < z < 1.24573566825068198e-98Initial program 0.1
rmApplied div-inv0.3
Final simplification0.8
herbie shell --seed 2020162
(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))