\frac{x \cdot y - z \cdot t}{a}\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \leq -5.03804754410112 \cdot 10^{+227} \lor \neg \left(x \cdot y - z \cdot t \leq 2.2366251910900706 \cdot 10^{+257}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{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 (or (<= (- (* x y) (* z t)) -5.03804754410112e+227)
(not (<= (- (* x y) (* z t)) 2.2366251910900706e+257)))
(- (* x (/ y a)) (* z (/ t a)))
(* (- (* x y) (* z t)) (/ 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 tmp;
if ((((x * y) - (z * t)) <= -5.03804754410112e+227) || !(((x * y) - (z * t)) <= 2.2366251910900706e+257)) {
tmp = (x * (y / a)) - (z * (t / a));
} else {
tmp = ((x * y) - (z * t)) * (1.0 / 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.5 |
|---|---|
| Target | 6.3 |
| Herbie | 0.8 |
if (-.f64 (*.f64 x y) (*.f64 z t)) < -5.03804754410112e227 or 2.2366251910900706e257 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 37.7
rmApplied div-sub_binary6437.7
rmApplied *-un-lft-identity_binary6437.7
Applied times-frac_binary6418.6
Simplified18.6
rmApplied *-un-lft-identity_binary6418.6
Applied times-frac_binary640.5
Simplified0.5
if -5.03804754410112e227 < (-.f64 (*.f64 x y) (*.f64 z t)) < 2.2366251910900706e257Initial program 0.8
rmApplied div-inv_binary640.9
Final simplification0.8
herbie shell --seed 2020220
(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))