(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z) (/ a t))) (t_2 (- (* x y) (* z t))))
(if (<= t_2 (- INFINITY))
(fma y (/ x a) t_1)
(if (<= t_2 2.855096886471254e+271)
(/ (fma t (- z) (* x y)) a)
(fma x (/ y a) t_1)))))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 = -z / (a / t);
double t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(y, (x / a), t_1);
} else if (t_2 <= 2.855096886471254e+271) {
tmp = fma(t, -z, (x * y)) / a;
} else {
tmp = fma(x, (y / a), t_1);
}
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(-z) / Float64(a / t)) t_2 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(y, Float64(x / a), t_1); elseif (t_2 <= 2.855096886471254e+271) tmp = Float64(fma(t, Float64(-z), Float64(x * y)) / a); else tmp = fma(x, Float64(y / a), t_1); 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[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(y * N[(x / a), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 2.855096886471254e+271], N[(N[(t * (-z) + N[(x * y), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
t_1 := \frac{-z}{\frac{a}{t}}\\
t_2 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{a}, t_1\right)\\
\mathbf{elif}\;t_2 \leq 2.855096886471254 \cdot 10^{+271}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, -z, x \cdot y\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{a}, t_1\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.1 |
|---|---|
| Target | 5.5 |
| Herbie | 0.7 |
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 64.0
Applied egg-rr0.3
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 2.85509688647125402e271Initial program 0.7
Taylor expanded in x around 0 0.7
Simplified0.7
if 2.85509688647125402e271 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 46.8
Applied egg-rr0.3
Final simplification0.7
herbie shell --seed 2022153
(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))