x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\begin{array}{l}
\mathbf{if}\;x + \frac{e^{y \cdot \log \left(\frac{y}{y + z}\right)}}{y} \leq -4.24261594712533 \cdot 10^{+31}:\\
\;\;\;\;x + \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{y + z} \cdot \sqrt[3]{y + z}}\right)}^{y} \cdot {\left(\frac{\sqrt[3]{y}}{\sqrt[3]{y + z}}\right)}^{y}}{y}\\
\end{array}(FPCore (x y z) :precision binary64 (+ x (/ (exp (* y (log (/ y (+ z y))))) y)))
(FPCore (x y z)
:precision binary64
(if (<= (+ x (/ (exp (* y (log (/ y (+ y z))))) y)) -4.24261594712533e+31)
(+ x (/ 1.0 y))
(+
x
(/
(*
(pow (/ (* (cbrt y) (cbrt y)) (* (cbrt (+ y z)) (cbrt (+ y z)))) y)
(pow (/ (cbrt y) (cbrt (+ y z))) y))
y))))double code(double x, double y, double z) {
return x + (exp(y * log(y / (z + y))) / y);
}
double code(double x, double y, double z) {
double tmp;
if ((x + (exp(y * log(y / (y + z))) / y)) <= -4.24261594712533e+31) {
tmp = x + (1.0 / y);
} else {
tmp = x + ((pow(((cbrt(y) * cbrt(y)) / (cbrt(y + z) * cbrt(y + z))), y) * pow((cbrt(y) / cbrt(y + z)), y)) / y);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 5.9 |
|---|---|
| Target | 1.1 |
| Herbie | 1.4 |
if (+.f64 x (/.f64 (exp.f64 (*.f64 y (log.f64 (/.f64 y (+.f64 z y))))) y)) < -4.24261594712532992e31Initial program 8.9
Simplified8.9
Taylor expanded around 0 0.0
if -4.24261594712532992e31 < (+.f64 x (/.f64 (exp.f64 (*.f64 y (log.f64 (/.f64 y (+.f64 z y))))) y)) Initial program 4.3
Simplified4.3
rmApplied add-cube-cbrt_binary64_1204821.2
Applied add-cube-cbrt_binary64_120484.3
Applied times-frac_binary64_120194.3
Applied unpow-prod-down_binary64_120922.2
Final simplification1.4
herbie shell --seed 2021043
(FPCore (x y z)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"
:precision binary64
:herbie-target
(if (< (/ y (+ z y)) 7.1154157597908e-315) (+ x (/ (exp (/ -1.0 z)) y)) (+ x (/ (exp (log (pow (/ y (+ y z)) y))) y)))
(+ x (/ (exp (* y (log (/ y (+ z y))))) y)))