(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
(FPCore (x y z t)
:precision binary64
(if (<= (* z t) -9.471189559324319e+123)
(/ 1.0 (fma y (/ 1.0 x) (* t (/ (- z) x))))
(if (<= (* z t) 2.8428336325098687e+246)
(/ x (- y (* z t)))
(/ 1.0 (* z (/ (- t) x))))))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 tmp;
if ((z * t) <= -9.471189559324319e+123) {
tmp = 1.0 / fma(y, (1.0 / x), (t * (-z / x)));
} else if ((z * t) <= 2.8428336325098687e+246) {
tmp = x / (y - (z * t));
} else {
tmp = 1.0 / (z * (-t / x));
}
return tmp;
}
function code(x, y, z, t) return Float64(x / Float64(y - Float64(z * t))) end
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= -9.471189559324319e+123) tmp = Float64(1.0 / fma(y, Float64(1.0 / x), Float64(t * Float64(Float64(-z) / x)))); elseif (Float64(z * t) <= 2.8428336325098687e+246) tmp = Float64(x / Float64(y - Float64(z * t))); else tmp = Float64(1.0 / Float64(z * Float64(Float64(-t) / x))); end return tmp end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], -9.471189559324319e+123], N[(1.0 / N[(y * N[(1.0 / x), $MachinePrecision] + N[(t * N[((-z) / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2.8428336325098687e+246], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(z * N[((-t) / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\frac{x}{y - z \cdot t}
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -9.471189559324319 \cdot 10^{+123}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(y, \frac{1}{x}, t \cdot \frac{-z}{x}\right)}\\
\mathbf{elif}\;z \cdot t \leq 2.8428336325098687 \cdot 10^{+246}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z \cdot \frac{-t}{x}}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 2.8 |
|---|---|
| Target | 1.8 |
| Herbie | 0.6 |
if (*.f64 z t) < -9.47118955932431904e123Initial program 8.0
Applied egg-rr8.0
Applied egg-rr8.5
Applied egg-rr32.4
Taylor expanded in z around 0 2.4
if -9.47118955932431904e123 < (*.f64 z t) < 2.8428336325098687e246Initial program 0.1
if 2.8428336325098687e246 < (*.f64 z t) Initial program 14.9
Applied egg-rr14.9
Applied egg-rr15.1
Taylor expanded in y around 0 15.8
Simplified1.7
Final simplification0.6
herbie shell --seed 2022151
(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))))