x + \frac{\left(y - z\right) \cdot t}{a - z}
\begin{array}{l}
t_1 := \frac{z}{a - z}\\
t_2 := t \cdot t_1\\
t_3 := \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{if}\;t_3 \leq -1.434595622850509 \cdot 10^{+210}:\\
\;\;\;\;\left(t \cdot \frac{y}{a - z} - t_2\right) + x\\
\mathbf{elif}\;t_3 \leq 3.123290212595791 \cdot 10^{+224}:\\
\;\;\;\;x + \left(\frac{y \cdot t}{a - z} - t_2\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \left(\frac{1}{\frac{a - z}{y}} - t_1\right)\\
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ z (- a z))) (t_2 (* t t_1)) (t_3 (/ (* (- y z) t) (- a z))))
(if (<= t_3 -1.434595622850509e+210)
(+ (- (* t (/ y (- a z))) t_2) x)
(if (<= t_3 3.123290212595791e+224)
(+ x (- (/ (* y t) (- a z)) t_2))
(+ x (* t (- (/ 1.0 (/ (- a z) y)) t_1)))))))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 t_1 = z / (a - z);
double t_2 = t * t_1;
double t_3 = ((y - z) * t) / (a - z);
double tmp;
if (t_3 <= -1.434595622850509e+210) {
tmp = ((t * (y / (a - z))) - t_2) + x;
} else if (t_3 <= 3.123290212595791e+224) {
tmp = x + (((y * t) / (a - z)) - t_2);
} else {
tmp = x + (t * ((1.0 / ((a - z) / y)) - t_1));
}
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.6 |
|---|---|
| Target | 0.6 |
| Herbie | 0.6 |
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -1.4345956228505089e210Initial program 49.4
Simplified4.3
Applied fma-udef_binary644.3
Simplified1.9
Applied add-cbrt-cube_binary6410.1
Simplified10.1
Applied sub-neg_binary6410.1
Applied distribute-rgt-in_binary6410.1
Simplified1.9
Simplified1.9
if -1.4345956228505089e210 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < 3.123290212595791e224Initial program 0.2
Simplified3.0
Applied fma-udef_binary643.0
Simplified1.2
Applied sub-neg_binary641.2
Applied distribute-rgt-in_binary641.2
Simplified0.3
Simplified0.3
if 3.123290212595791e224 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 51.2
Simplified3.9
Applied fma-udef_binary643.9
Simplified1.8
Applied clear-num_binary641.8
Final simplification0.6
herbie shell --seed 2022068
(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))))