\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
t_1 := \frac{t \cdot z}{a}\\
\mathbf{if}\;x \cdot y \leq -1.5883757317364673 \cdot 10^{+177}:\\
\;\;\;\;y \cdot \frac{x}{a} - t_1\\
\mathbf{elif}\;x \cdot y \leq 4.461355465903499 \cdot 10^{+292}:\\
\;\;\;\;\frac{x \cdot y}{a} - t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}} - t_1\\
\end{array}
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* t z) a)))
(if (<= (* x y) -1.5883757317364673e+177)
(- (* y (/ x a)) t_1)
(if (<= (* x y) 4.461355465903499e+292)
(- (/ (* x y) a) t_1)
(- (/ y (/ a x)) 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 = (t * z) / a;
double tmp;
if ((x * y) <= -1.5883757317364673e+177) {
tmp = (y * (x / a)) - t_1;
} else if ((x * y) <= 4.461355465903499e+292) {
tmp = ((x * y) / a) - t_1;
} else {
tmp = (y / (a / x)) - t_1;
}
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.5 |
|---|---|
| Target | 6.3 |
| Herbie | 4.3 |
if (*.f64 x y) < -1.5883757317364673e177Initial program 27.4
Taylor expanded in x around 0 27.4
Applied *-un-lft-identity_binary6427.4
Applied times-frac_binary646.9
Simplified6.9
if -1.5883757317364673e177 < (*.f64 x y) < 4.461355465903499e292Initial program 3.9
Taylor expanded in x around 0 3.9
if 4.461355465903499e292 < (*.f64 x y) Initial program 54.4
Taylor expanded in x around 0 54.4
Applied associate-/l*_binary649.8
Final simplification4.3
herbie shell --seed 2021307
(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))