x + \frac{\left(y - z\right) \cdot t}{a - z}
\begin{array}{l}
\mathbf{if}\;t \leq -1.6302512175718477 \cdot 10^{-77}:\\
\;\;\;\;t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right) + x\\
\mathbf{elif}\;t \leq 6.335412352147459 \cdot 10^{-139}:\\
\;\;\;\;\left(x + \frac{t \cdot y}{a - z}\right) - \frac{t \cdot z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y - z}{a - z}\\
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.6302512175718477e-77)
(+ (* t (- (/ y (- a z)) (/ z (- a z)))) x)
(if (<= t 6.335412352147459e-139)
(- (+ x (/ (* t y) (- a z))) (/ (* t z) (- a z)))
(+ x (* t (/ (- y z) (- a z)))))))double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.6302512175718477e-77) {
tmp = (t * ((y / (a - z)) - (z / (a - z)))) + x;
} else if (t <= 6.335412352147459e-139) {
tmp = (x + ((t * y) / (a - z))) - ((t * z) / (a - z));
} else {
tmp = x + (t * ((y - z) / (a - z)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 10.9 |
|---|---|
| Target | 0.6 |
| Herbie | 0.6 |
if t < -1.63025121757184772e-77Initial program 18.1
Simplified2.2
Applied fma-udef_binary642.2
Simplified0.4
if -1.63025121757184772e-77 < t < 6.3354123521474588e-139Initial program 0.3
Simplified3.3
Taylor expanded in y around 0 0.3
if 6.3354123521474588e-139 < t Initial program 15.5
Simplified2.8
Applied fma-udef_binary642.8
Simplified1.0
Applied sub-div_binary641.0
Final simplification0.6
herbie shell --seed 2021224
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))
(+ x (/ (* (- y z) t) (- a z))))