(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))) (t_2 (fma x (/ y a) (/ (- z) (/ a t)))))
(if (<= t_1 -5e+180)
t_2
(if (<= t_1 2e+152) (/ (fma z (- t) (* x y)) a) t_2))))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 t_2 = fma(x, (y / a), (-z / (a / t)));
double tmp;
if (t_1 <= -5e+180) {
tmp = t_2;
} else if (t_1 <= 2e+152) {
tmp = fma(z, -t, (x * y)) / a;
} else {
tmp = t_2;
}
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)) t_2 = fma(x, Float64(y / a), Float64(Float64(-z) / Float64(a / t))) tmp = 0.0 if (t_1 <= -5e+180) tmp = t_2; elseif (t_1 <= 2e+152) tmp = Float64(fma(z, Float64(-t), Float64(x * y)) / a); else tmp = t_2; 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]}, Block[{t$95$2 = N[(x * N[(y / a), $MachinePrecision] + N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+180], t$95$2, If[LessEqual[t$95$1, 2e+152], N[(N[(z * (-t) + N[(x * y), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$2]]]]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
t_2 := \mathsf{fma}\left(x, \frac{y}{a}, \frac{-z}{\frac{a}{t}}\right)\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+180}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+152}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, -t, x \cdot y\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 7.3 |
|---|---|
| Target | 5.3 |
| Herbie | 1.3 |
if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999996e180 or 2.0000000000000001e152 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 22.3
Applied egg-rr2.3
if -4.9999999999999996e180 < (-.f64 (*.f64 x y) (*.f64 z t)) < 2.0000000000000001e152Initial program 0.9
Applied egg-rr1.4
Taylor expanded in x around 0 0.9
Simplified0.8
Final simplification1.3
herbie shell --seed 2022166
(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))