(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (<= t_1 -2e+284)
(fma x (/ y a) (/ (- z) (/ a t)))
(if (<= t_1 1e+191)
(- (/ (* x y) a) (/ (* z t) a))
(- (/ x (/ a y)) (* z (/ t a)))))))double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -2e+284) {
tmp = fma(x, (y / a), (-z / (a / t)));
} else if (t_1 <= 1e+191) {
tmp = ((x * y) / a) - ((z * t) / a);
} else {
tmp = (x / (a / y)) - (z * (t / a));
}
return tmp;
}
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= -2e+284) tmp = fma(x, Float64(y / a), Float64(Float64(-z) / Float64(a / t))); elseif (t_1 <= 1e+191) tmp = Float64(Float64(Float64(x * y) / a) - Float64(Float64(z * t) / a)); else tmp = Float64(Float64(x / Float64(a / y)) - Float64(z * Float64(t / a))); end return tmp end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+284], N[(x * N[(y / a), $MachinePrecision] + N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+191], N[(N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision] - N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+284}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{a}, \frac{-z}{\frac{a}{t}}\right)\\
\mathbf{elif}\;t_1 \leq 10^{+191}:\\
\;\;\;\;\frac{x \cdot y}{a} - \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - z \cdot \frac{t}{a}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 7.4 |
|---|---|
| Target | 5.5 |
| Herbie | 0.8 |
if (-.f64 (*.f64 x y) (*.f64 z t)) < -2.00000000000000016e284Initial program 50.5
Applied egg-rr0.2
if -2.00000000000000016e284 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000007e191Initial program 0.7
Taylor expanded in x around 0 0.7
if 1.00000000000000007e191 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 26.4
Applied egg-rr1.4
Applied egg-rr1.4
Final simplification0.8
herbie shell --seed 2022162
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:herbie-target
(if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))
(/ (- (* x y) (* z t)) a))