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.240768941608061 \cdot 10^{-262}:\\
\;\;\;\;\frac{y}{z} \cdot x - \frac{t}{1 - z} \cdot x\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq 4.6743336160568 \cdot 10^{-314}:\\
\;\;\;\;\frac{y \cdot x}{z} - \frac{t \cdot x}{1 - z}\\
\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \leq 5.218701122969269 \cdot 10^{+133}:\\
\;\;\;\;\left(\frac{y}{z} - \frac{t}{1 - z}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z} - \left(\frac{t \cdot \left(z \cdot x\right)}{1 - {z}^{2}} + \frac{t \cdot x}{1 - {z}^{2}}\right)\\
\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.240768941608061e-262)
(- (* (/ y z) x) (* (/ t (- 1.0 z)) x))
(if (<= (- (/ y z) (/ t (- 1.0 z))) 4.6743336160568e-314)
(- (/ (* y x) z) (/ (* t x) (- 1.0 z)))
(if (<= (- (/ y z) (/ t (- 1.0 z))) 5.218701122969269e+133)
(* (- (/ y z) (/ t (- 1.0 z))) x)
(-
(/ (* y x) z)
(+
(/ (* t (* z x)) (- 1.0 (pow z 2.0)))
(/ (* t x) (- 1.0 (pow z 2.0)))))))))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.240768941608061e-262) {
tmp = ((y / z) * x) - ((t / (1.0 - z)) * x);
} else if (((y / z) - (t / (1.0 - z))) <= 4.6743336160568e-314) {
tmp = ((y * x) / z) - ((t * x) / (1.0 - z));
} else if (((y / z) - (t / (1.0 - z))) <= 5.218701122969269e+133) {
tmp = ((y / z) - (t / (1.0 - z))) * x;
} else {
tmp = ((y * x) / z) - (((t * (z * x)) / (1.0 - pow(z, 2.0))) + ((t * x) / (1.0 - pow(z, 2.0))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.7 |
|---|---|
| Target | 4.3 |
| Herbie | 2.5 |
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -4.240768941608061e-262Initial program 3.8
rmApplied sub-neg_binary64_133703.8
Applied distribute-rgt-in_binary64_133273.8
if -4.240768941608061e-262 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 4.67433361606e-314Initial program 16.1
rmApplied add-cube-cbrt_binary64_1341216.2
Applied associate-*l*_binary64_1331816.2
Simplified16.2
Taylor expanded around 0 0.2
if 4.67433361606e-314 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 5.21870112296926865e133Initial program 0.2
if 5.21870112296926865e133 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 12.8
rmApplied flip--_binary64_1335213.0
Applied associate-/r/_binary64_1332313.0
Simplified13.0
Taylor expanded around 0 4.3
Final simplification2.5
herbie shell --seed 2021096
(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)))))