x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\begin{array}{l}
\mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le -1.7719375982154692 \cdot 10^{186} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le -2.16390322287129159 \cdot 10^{-24} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 2.379884009843327 \cdot 10^{-235} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 4.61028574925404029 \cdot 10^{228}\right)\right)\right):\\
\;\;\;\;\left(-x\right) \cdot \frac{t}{1 - z} + \frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(y, \frac{1}{z}, \frac{-t}{1 - z}\right)\\
\end{array}double code(double x, double y, double z, double t) {
return (x * ((y / z) - (t / (1.0 - z))));
}
double code(double x, double y, double z, double t) {
double temp;
if (((((y / z) - (t / (1.0 - z))) <= -1.7719375982154692e+186) || !((((y / z) - (t / (1.0 - z))) <= -2.1639032228712916e-24) || !((((y / z) - (t / (1.0 - z))) <= 2.379884009843327e-235) || !(((y / z) - (t / (1.0 - z))) <= 4.61028574925404e+228))))) {
temp = ((-x * (t / (1.0 - z))) + ((x * y) / z));
} else {
temp = (x * fma(y, (1.0 / z), (-t / (1.0 - z))));
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.6 |
|---|---|
| Target | 4.2 |
| Herbie | 1.6 |
if (- (/ y z) (/ t (- 1.0 z))) < -1.7719375982154692e+186 or -2.1639032228712916e-24 < (- (/ y z) (/ t (- 1.0 z))) < 2.379884009843327e-235 or 4.61028574925404e+228 < (- (/ y z) (/ t (- 1.0 z))) Initial program 11.0
rmApplied div-inv11.0
rmApplied sub-neg11.0
Applied distribute-lft-in11.0
Simplified11.0
rmApplied *-un-lft-identity11.0
Applied add-cube-cbrt11.4
Applied times-frac11.4
Applied associate-*r*5.1
Simplified5.1
rmApplied pow15.1
Applied pow15.1
Applied pow15.1
Applied pow15.1
Applied pow-prod-down5.1
Applied pow-prod-down5.1
Applied pow-prod-down5.1
Simplified3.6
if -1.7719375982154692e+186 < (- (/ y z) (/ t (- 1.0 z))) < -2.1639032228712916e-24 or 2.379884009843327e-235 < (- (/ y z) (/ t (- 1.0 z))) < 4.61028574925404e+228Initial program 0.2
rmApplied div-inv0.2
rmApplied div-inv0.3
Applied fma-neg0.3
Simplified0.3
Final simplification1.6
herbie shell --seed 2020057 +o rules:numerics
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:herbie-target
(if (< (* x (- (/ y z) (/ t (- 1 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z)))))))
(* x (- (/ y z) (/ t (- 1 z)))))