(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 (- INFINITY))
(- (* y (/ x a)) (/ t (/ a z)))
(if (<= t_1 3.547676409310532e+242)
(- (/ (* x y) a) (/ (* z t) a))
(fma y (/ x a) (* t (* z (/ -1.0 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 <= -((double) INFINITY)) {
tmp = (y * (x / a)) - (t / (a / z));
} else if (t_1 <= 3.547676409310532e+242) {
tmp = ((x * y) / a) - ((z * t) / a);
} else {
tmp = fma(y, (x / a), (t * (z * (-1.0 / 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 <= Float64(-Inf)) tmp = Float64(Float64(y * Float64(x / a)) - Float64(t / Float64(a / z))); elseif (t_1 <= 3.547676409310532e+242) tmp = Float64(Float64(Float64(x * y) / a) - Float64(Float64(z * t) / a)); else tmp = fma(y, Float64(x / a), Float64(t * Float64(z * Float64(-1.0 / 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, (-Infinity)], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 3.547676409310532e+242], N[(N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision] - N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision] + N[(t * N[(z * N[(-1.0 / a), $MachinePrecision]), $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 -\infty:\\
\;\;\;\;y \cdot \frac{x}{a} - \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;t_1 \leq 3.547676409310532 \cdot 10^{+242}:\\
\;\;\;\;\frac{x \cdot y}{a} - \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{a}, t \cdot \left(z \cdot \frac{-1}{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.6 |
|---|---|
| Target | 5.9 |
| Herbie | 0.7 |
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 64.0
Applied egg-rr34.2
Applied egg-rr0.2
Applied egg-rr0.3
Applied egg-rr0.3
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 3.5476764093105318e242Initial program 0.7
Taylor expanded in x around 0 0.7
if 3.5476764093105318e242 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 37.2
Applied egg-rr21.4
Applied egg-rr0.9
Final simplification0.7
herbie shell --seed 2022133
(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))