\frac{x + y \cdot \left(z - x\right)}{z}
\begin{array}{l}
t_0 := \mathsf{fma}\left(-y, \frac{x}{z}, y\right)\\
\mathbf{if}\;y \leq -1.2596917542803703 \cdot 10^{+36}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.9501817946579704 \cdot 10^{+39}:\\
\;\;\;\;\left(y + \frac{x}{z}\right) - \frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fma (- y) (/ x z) y)))
(if (<= y -1.2596917542803703e+36)
t_0
(if (<= y 1.9501817946579704e+39) (- (+ y (/ x z)) (/ (* y x) z)) t_0))))double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
double code(double x, double y, double z) {
double t_0 = fma(-y, (x / z), y);
double tmp;
if (y <= -1.2596917542803703e+36) {
tmp = t_0;
} else if (y <= 1.9501817946579704e+39) {
tmp = (y + (x / z)) - ((y * x) / z);
} else {
tmp = t_0;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 10.3 |
|---|---|
| Target | 0.0 |
| Herbie | 0.1 |
if y < -1.2596917542803703e36 or 1.95018179465797035e39 < y Initial program 25.6
Simplified25.6
Taylor expanded in y around inf 25.6
Simplified0.1
Applied egg-rr0.1
Applied egg-rr0.1
if -1.2596917542803703e36 < y < 1.95018179465797035e39Initial program 0.5
Simplified0.5
Taylor expanded in y around 0 0.2
Final simplification0.1
herbie shell --seed 2022130
(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))