\frac{x + y \cdot \left(z - x\right)}{z}\begin{array}{l}
\mathbf{if}\;z \leq -6905077904.134682 \lor \neg \left(z \leq 3.1075019531474167 \cdot 10^{-105}\right):\\
\;\;\;\;y + x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
(FPCore (x y z) :precision binary64 (if (or (<= z -6905077904.134682) (not (<= z 3.1075019531474167e-105))) (+ y (* x (/ (- 1.0 y) z))) (/ (+ x (* y (- z x))) z)))
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 tmp;
if (((z <= -6905077904.134682) || !(z <= 3.1075019531474167e-105))) {
tmp = ((double) (y + ((double) (x * (((double) (1.0 - y)) / z)))));
} else {
tmp = (((double) (x + ((double) (y * ((double) (z - x)))))) / z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 9.9 |
|---|---|
| Target | 0.0 |
| Herbie | 0.4 |
if z < -6905077904.1346817 or 3.10750195314741666e-105 < z Initial program Error: 14.6 bits
SimplifiedError: 0.5 bits
if -6905077904.1346817 < z < 3.10750195314741666e-105Initial program Error: 0.1 bits
Final simplificationError: 0.4 bits
herbie shell --seed 2020204
(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))