\frac{x}{y - z \cdot t}
\begin{array}{l}
t_1 := \frac{1}{\frac{y}{x} - t \cdot \frac{z}{x}}\\
\mathbf{if}\;z \cdot t \leq -5.730067932082404 \cdot 10^{+303}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq 1.7341482575187142 \cdot 10^{+305}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ 1.0 (- (/ y x) (* t (/ z x))))))
(if (<= (* z t) -5.730067932082404e+303)
t_1
(if (<= (* z t) 1.7341482575187142e+305) (/ x (- y (* z t))) t_1))))double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / ((y / x) - (t * (z / x)));
double tmp;
if ((z * t) <= -5.730067932082404e+303) {
tmp = t_1;
} else if ((z * t) <= 1.7341482575187142e+305) {
tmp = x / (y - (z * t));
} else {
tmp = t_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.1 |
|---|---|
| Target | 1.9 |
| Herbie | 0.7 |
if (*.f64 z t) < -5.7300679320824035e303 or 1.7341482575187142e305 < (*.f64 z t) Initial program 21.2
Applied clear-num_binary6421.2
Taylor expanded in y around 0 25.1
Applied *-un-lft-identity_binary6425.1
Applied times-frac_binary644.7
Simplified4.7
if -5.7300679320824035e303 < (*.f64 z t) < 1.7341482575187142e305Initial program 0.1
Final simplification0.7
herbie shell --seed 2022125
(FPCore (x y z t)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
:herbie-target
(if (< x -1.618195973607049e+50) (/ 1.0 (- (/ y x) (* (/ z x) t))) (if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) (/ 1.0 (- (/ y x) (* (/ z x) t)))))
(/ x (- y (* z t))))