\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;\begin{array}{l}
t_1 := \frac{x \cdot y - z \cdot t}{a}\\
t_1 \leq -\infty \lor \neg \left(t_1 \leq 5.121082684900786 \cdot 10^{+281}\right)
\end{array}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a} - \frac{z \cdot t}{a}\\
\end{array}
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
(FPCore (x y z t a)
:precision binary64
(if (let* ((t_1 (/ (- (* x y) (* z t)) a)))
(or (<= t_1 (- INFINITY)) (not (<= t_1 5.121082684900786e+281))))
(* x (/ y a))
(- (/ (* 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)) / a;
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5.121082684900786e+281)) {
tmp = x * (y / a);
} else {
tmp = ((x * y) / a) - ((z * t) / a);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 7.8 |
|---|---|
| Target | 6.0 |
| Herbie | 5.1 |
if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < -inf.0 or 5.12108268490078629e281 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) Initial program 56.4
Applied add-cube-cbrt_binary6456.5
Taylor expanded in x around inf 59.9
Simplified35.0
if -inf.0 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 5.12108268490078629e281Initial program 0.8
Taylor expanded in x around 0 0.8
Final simplification5.1
herbie shell --seed 2021275
(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))