(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 -2.4568731715777092e+275)
(fma (/ (- t) a) z (* x (/ y a)))
(if (<= t_1 3.264168360365097e+290)
(/ (fma x y (* t (- z))) a)
(fma x (/ y a) (/ (- z) (/ a t)))))))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 <= -2.4568731715777092e+275) {
tmp = fma((-t / a), z, (x * (y / a)));
} else if (t_1 <= 3.264168360365097e+290) {
tmp = fma(x, y, (t * -z)) / a;
} else {
tmp = fma(x, (y / a), (-z / (a / t)));
}
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 <= -2.4568731715777092e+275) tmp = fma(Float64(Float64(-t) / a), z, Float64(x * Float64(y / a))); elseif (t_1 <= 3.264168360365097e+290) tmp = Float64(fma(x, y, Float64(t * Float64(-z))) / a); else tmp = fma(x, Float64(y / a), Float64(Float64(-z) / Float64(a / t))); 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, -2.4568731715777092e+275], N[(N[((-t) / a), $MachinePrecision] * z + N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 3.264168360365097e+290], N[(N[(x * y + N[(t * (-z)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision] + N[((-z) / N[(a / t), $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.4568731715777092 \cdot 10^{+275}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{a}, z, x \cdot \frac{y}{a}\right)\\
\mathbf{elif}\;t_1 \leq 3.264168360365097 \cdot 10^{+290}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{a}, \frac{-z}{\frac{a}{t}}\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.3 |
|---|---|
| Target | 5.8 |
| Herbie | 0.7 |
if (-.f64 (*.f64 x y) (*.f64 z t)) < -2.4568731715777092e275Initial program 46.7
Applied egg-rr0.3
Applied egg-rr0.4
Applied egg-rr0.4
if -2.4568731715777092e275 < (-.f64 (*.f64 x y) (*.f64 z t)) < 3.2641683603650968e290Initial program 0.7
Applied egg-rr0.7
if 3.2641683603650968e290 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 53.5
Applied egg-rr0.3
Final simplification0.7
herbie shell --seed 2022150
(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))