(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 (/ y (- (/ t z) a))) (t_2 (- t (* z a))))
(if (<= z -1.965510614121794e+42)
(- (/ x t_2) t_1)
(if (<= z 4.4228944462314166e-44)
(/ (- x (* z y)) (fma (- a) z t))
(- (pow (/ t_2 x) -1.0) 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 = y / ((t / z) - a);
double t_2 = t - (z * a);
double tmp;
if (z <= -1.965510614121794e+42) {
tmp = (x / t_2) - t_1;
} else if (z <= 4.4228944462314166e-44) {
tmp = (x - (z * y)) / fma(-a, z, t);
} else {
tmp = pow((t_2 / x), -1.0) - t_1;
}
return tmp;
}
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function code(x, y, z, t, a) t_1 = Float64(y / Float64(Float64(t / z) - a)) t_2 = Float64(t - Float64(z * a)) tmp = 0.0 if (z <= -1.965510614121794e+42) tmp = Float64(Float64(x / t_2) - t_1); elseif (z <= 4.4228944462314166e-44) tmp = Float64(Float64(x - Float64(z * y)) / fma(Float64(-a), z, t)); else tmp = Float64((Float64(t_2 / x) ^ -1.0) - t_1); end return tmp end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.965510614121794e+42], N[(N[(x / t$95$2), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[z, 4.4228944462314166e-44], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[((-a) * z + t), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(t$95$2 / x), $MachinePrecision], -1.0], $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\frac{x - y \cdot z}{t - a \cdot z}
\begin{array}{l}
t_1 := \frac{y}{\frac{t}{z} - a}\\
t_2 := t - z \cdot a\\
\mathbf{if}\;z \leq -1.965510614121794 \cdot 10^{+42}:\\
\;\;\;\;\frac{x}{t_2} - t_1\\
\mathbf{elif}\;z \leq 4.4228944462314166 \cdot 10^{-44}:\\
\;\;\;\;\frac{x - z \cdot y}{\mathsf{fma}\left(-a, z, t\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{t_2}{x}\right)}^{-1} - t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 11.0 |
|---|---|
| Target | 1.8 |
| Herbie | 1.7 |
if z < -1.965510614121794e42Initial program 24.7
Taylor expanded in x around 0 24.7
Simplified15.4
Taylor expanded in t around 0 3.5
if -1.965510614121794e42 < z < 4.4228944462314166e-44Initial program 0.3
Applied egg-rr0.3
if 4.4228944462314166e-44 < z Initial program 18.8
Taylor expanded in x around 0 18.8
Simplified12.1
Taylor expanded in t around 0 2.7
Applied egg-rr2.8
Final simplification1.7
herbie shell --seed 2022152
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< z -32113435955957344.0) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a)))))
(/ (- x (* y z)) (- t (* a z))))