\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\begin{array}{l}
t_1 := t \cdot \log a\\
t_2 := y \cdot \log z\\
t_3 := \frac{x \cdot e^{\left(t_2 + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\
\mathbf{if}\;t_3 \leq -8.538211024059792 \cdot 10^{-135}:\\
\;\;\;\;\begin{array}{l}
t_4 := \frac{{z}^{y}}{a \cdot e^{b}} \cdot \frac{x}{y}\\
t_4 + t_4 \cdot t_1
\end{array}\\
\mathbf{elif}\;t_3 \leq 1.69252999221247 \cdot 10^{-128}:\\
\;\;\;\;\frac{x}{\frac{y}{e^{t_2 - \left(b - \left(t_1 - \log a\right)\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{e^{b} \cdot \frac{y}{x \cdot \left({a}^{t} \cdot \frac{{z}^{y}}{a}\right)}}\\
\end{array}
(FPCore (x y z t a b) :precision binary64 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* t (log a)))
(t_2 (* y (log z)))
(t_3 (/ (* x (exp (- (+ t_2 (* (- t 1.0) (log a))) b))) y)))
(if (<= t_3 -8.538211024059792e-135)
(let* ((t_4 (* (/ (pow z y) (* a (exp b))) (/ x y)))) (+ t_4 (* t_4 t_1)))
(if (<= t_3 1.69252999221247e-128)
(/ x (/ y (exp (- t_2 (- b (- t_1 (log a)))))))
(/ 1.0 (* (exp b) (/ y (* x (* (pow a t) (/ (pow z y) a))))))))))double code(double x, double y, double z, double t, double a, double b) {
return (x * exp(((y * log(z)) + ((t - 1.0) * log(a))) - b)) / y;
}
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t * log(a);
double t_2 = y * log(z);
double t_3 = (x * exp((t_2 + ((t - 1.0) * log(a))) - b)) / y;
double tmp;
if (t_3 <= -8.538211024059792e-135) {
double t_4_1 = (pow(z, y) / (a * exp(b))) * (x / y);
tmp = t_4_1 + (t_4_1 * t_1);
} else if (t_3 <= 1.69252999221247e-128) {
tmp = x / (y / exp(t_2 - (b - (t_1 - log(a)))));
} else {
tmp = 1.0 / (exp(b) * (y / (x * (pow(a, t) * (pow(z, y) / a)))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b
Results
| Original | 2.2 |
|---|---|
| Target | 11.4 |
| Herbie | 1.1 |
if (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t 1) (log.f64 a))) b))) y) < -8.5382110240597924e-135Initial program 5.9
Taylor expanded in t around 0 6.5
Simplified11.9
if -8.5382110240597924e-135 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t 1) (log.f64 a))) b))) y) < 1.6925299922124701e-128Initial program 1.6
Applied associate-/l*_binary640.2
Simplified19.8
Applied unpow-prod-up_binary6419.8
Applied add-exp-log_binary6420.0
Applied pow-to-exp_binary6420.0
Applied prod-exp_binary6420.0
Applied div-exp_binary6413.5
Applied pow-to-exp_binary6413.5
Applied div-exp_binary640.3
Simplified0.2
if 1.6925299922124701e-128 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t 1) (log.f64 a))) b))) y) Initial program 6.0
Applied clear-num_binary646.0
Applied exp-diff_binary646.0
Applied associate-*r/_binary646.0
Applied associate-/r/_binary646.0
Simplified0.8
Final simplification1.1
herbie shell --seed 2021224
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(if (< t -0.8845848504127471) (/ (* x (/ (pow a (- t 1.0)) y)) (- (+ b 1.0) (* y (log z)))) (if (< t 852031.2288374073) (/ (* (/ x y) (pow a (- t 1.0))) (exp (- b (* (log z) y)))) (/ (* x (/ (pow a (- t 1.0)) y)) (- (+ b 1.0) (* y (log z))))))
(/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))