x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\begin{array}{l}
\mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \leq -4.1287833379471316 \cdot 10^{+291}:\\
\;\;\;\;\frac{y \cdot x}{z} - \frac{t}{1 - z} \cdot x\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq -1.157283630842069 \cdot 10^{-240}:\\
\;\;\;\;\frac{x}{\frac{z}{y}} - \frac{t}{1 - z} \cdot x\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq 4.9481558492305 \cdot 10^{-314}:\\
\;\;\;\;\frac{x}{z} \cdot \left(t + \left(y + \frac{t}{z}\right)\right)\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq 4.410473996090381 \cdot 10^{+198}:\\
\;\;\;\;\frac{y}{z} \cdot x - \frac{t}{1 - z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z} - \frac{t}{1 - z} \cdot x\\
\end{array}(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
(FPCore (x y z t)
:precision binary64
(if (<= (- (/ y z) (/ t (- 1.0 z))) -4.1287833379471316e+291)
(- (/ (* y x) z) (* (/ t (- 1.0 z)) x))
(if (<= (- (/ y z) (/ t (- 1.0 z))) -1.157283630842069e-240)
(- (/ x (/ z y)) (* (/ t (- 1.0 z)) x))
(if (<= (- (/ y z) (/ t (- 1.0 z))) 4.9481558492305e-314)
(* (/ x z) (+ t (+ y (/ t z))))
(if (<= (- (/ y z) (/ t (- 1.0 z))) 4.410473996090381e+198)
(- (* (/ y z) x) (* (/ t (- 1.0 z)) x))
(- (/ (* y x) z) (* (/ t (- 1.0 z)) x)))))))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 tmp;
if (((y / z) - (t / (1.0 - z))) <= -4.1287833379471316e+291) {
tmp = ((y * x) / z) - ((t / (1.0 - z)) * x);
} else if (((y / z) - (t / (1.0 - z))) <= -1.157283630842069e-240) {
tmp = (x / (z / y)) - ((t / (1.0 - z)) * x);
} else if (((y / z) - (t / (1.0 - z))) <= 4.9481558492305e-314) {
tmp = (x / z) * (t + (y + (t / z)));
} else if (((y / z) - (t / (1.0 - z))) <= 4.410473996090381e+198) {
tmp = ((y / z) * x) - ((t / (1.0 - z)) * x);
} else {
tmp = ((y * x) / z) - ((t / (1.0 - z)) * x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.7 |
|---|---|
| Target | 4.2 |
| Herbie | 0.3 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -4.1287833379471316e291 or 4.4104739960903812e198 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 27.0
rmApplied sub-neg_binary64_1220227.0
Applied distribute-rgt-in_binary64_1216127.0
Simplified27.0
Simplified27.0
rmApplied associate-*r/_binary64_121530.7
if -4.1287833379471316e291 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -1.15728363084206897e-240Initial program 0.2
rmApplied sub-neg_binary64_122020.2
Applied distribute-rgt-in_binary64_121610.2
Simplified0.2
Simplified0.2
rmApplied associate-*r/_binary64_121535.8
rmApplied associate-/l*_binary64_121560.2
if -1.15728363084206897e-240 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 4.9481558492e-314Initial program 15.1
Taylor expanded around inf 0.5
Simplified0.3
if 4.9481558492e-314 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 4.4104739960903812e198Initial program 0.2
rmApplied sub-neg_binary64_122020.2
Applied distribute-rgt-in_binary64_121610.2
Simplified0.2
Simplified0.2
Final simplification0.3
herbie shell --seed 2020280
(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.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))