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




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 7.5 |
|---|---|
| Target | 5.7 |
| Herbie | 1.4 |
if (-.f64 (*.f64 x y) (*.f64 z t)) < -5.0000000000000003e181Initial program 25.1
Applied egg-rr1.3
Applied egg-rr1.6
if -5.0000000000000003e181 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000002e151Initial program 1.0
Applied egg-rr1.0
Applied egg-rr1.0
if 1.00000000000000002e151 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 20.7
Applied egg-rr3.0
Applied egg-rr2.9
Final simplification1.4
herbie shell --seed 2022170
(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))