\frac{x + y \cdot \left(z - x\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.41058353208740873 \cdot 10^{-42}:\\
\;\;\;\;\left(\frac{x}{z} + y\right) - \frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;z \le 1.09112860820187419 \cdot 10^{-112}:\\
\;\;\;\;\left(x + y \cdot \left(z - x\right)\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{z} + y\right) - x \cdot \frac{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.4105835320874087e-42)) {
VAR = ((double) (((double) (((double) (x / z)) + y)) - ((double) (x / ((double) (z / y))))));
} else {
double VAR_1;
if ((z <= 1.0911286082018742e-112)) {
VAR_1 = ((double) (((double) (x + ((double) (y * ((double) (z - x)))))) * ((double) (1.0 / z))));
} else {
VAR_1 = ((double) (((double) (((double) (x / z)) + y)) - ((double) (x * ((double) (y / z))))));
}
VAR = VAR_1;
}
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.4105835320874087e-42Initial program 14.8
Taylor expanded around 0 5.0
rmApplied associate-/l*0.1
if -1.4105835320874087e-42 < z < 1.0911286082018742e-112Initial program 0.1
rmApplied div-inv0.4
if 1.0911286082018742e-112 < z Initial program 13.2
Taylor expanded around 0 4.6
rmApplied *-un-lft-identity4.6
Applied times-frac0.6
Simplified0.6
Final simplification0.4
herbie shell --seed 2020120
(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))