(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 (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b)))
(t_2 (/ (* x t_1) y))
(t_3 (/ (pow a t) (* a (exp b)))))
(if (<= t_2 -2.2648629349364475e-40)
(/ (* x t_3) y)
(if (<= t_2 2.117665316366963e-252)
(/ x (/ y t_1))
(/ (* x (* t_3 (pow z y))) y)))))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 = exp((((y * log(z)) + ((t - 1.0) * log(a))) - b));
double t_2 = (x * t_1) / y;
double t_3 = pow(a, t) / (a * exp(b));
double tmp;
if (t_2 <= -2.2648629349364475e-40) {
tmp = (x * t_3) / y;
} else if (t_2 <= 2.117665316366963e-252) {
tmp = x / (y / t_1);
} else {
tmp = (x * (t_3 * pow(z, y))) / y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (x * exp((((y * log(z)) + ((t - 1.0d0) * log(a))) - b))) / y
end function
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = exp((((y * log(z)) + ((t - 1.0d0) * log(a))) - b))
t_2 = (x * t_1) / y
t_3 = (a ** t) / (a * exp(b))
if (t_2 <= (-2.2648629349364475d-40)) then
tmp = (x * t_3) / y
else if (t_2 <= 2.117665316366963d-252) then
tmp = x / (y / t_1)
else
tmp = (x * (t_3 * (z ** y))) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (x * Math.exp((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b))) / y;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.exp((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b));
double t_2 = (x * t_1) / y;
double t_3 = Math.pow(a, t) / (a * Math.exp(b));
double tmp;
if (t_2 <= -2.2648629349364475e-40) {
tmp = (x * t_3) / y;
} else if (t_2 <= 2.117665316366963e-252) {
tmp = x / (y / t_1);
} else {
tmp = (x * (t_3 * Math.pow(z, y))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
def code(x, y, z, t, a, b): t_1 = math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b)) t_2 = (x * t_1) / y t_3 = math.pow(a, t) / (a * math.exp(b)) tmp = 0 if t_2 <= -2.2648629349364475e-40: tmp = (x * t_3) / y elif t_2 <= 2.117665316366963e-252: tmp = x / (y / t_1) else: tmp = (x * (t_3 * math.pow(z, y))) / y return tmp
function code(x, y, z, t, a, b) return Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y) end
function code(x, y, z, t, a, b) t_1 = exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b)) t_2 = Float64(Float64(x * t_1) / y) t_3 = Float64((a ^ t) / Float64(a * exp(b))) tmp = 0.0 if (t_2 <= -2.2648629349364475e-40) tmp = Float64(Float64(x * t_3) / y); elseif (t_2 <= 2.117665316366963e-252) tmp = Float64(x / Float64(y / t_1)); else tmp = Float64(Float64(x * Float64(t_3 * (z ^ y))) / y); end return tmp end
function tmp = code(x, y, z, t, a, b) tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y; end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp((((y * log(z)) + ((t - 1.0) * log(a))) - b)); t_2 = (x * t_1) / y; t_3 = (a ^ t) / (a * exp(b)); tmp = 0.0; if (t_2 <= -2.2648629349364475e-40) tmp = (x * t_3) / y; elseif (t_2 <= 2.117665316366963e-252) tmp = x / (y / t_1); else tmp = (x * (t_3 * (z ^ y))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * t$95$1), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[a, t], $MachinePrecision] / N[(a * N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2.2648629349364475e-40], N[(N[(x * t$95$3), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$2, 2.117665316366963e-252], N[(x / N[(y / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t$95$3 * N[Power[z, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]]
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\begin{array}{l}
t_1 := e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}\\
t_2 := \frac{x \cdot t_1}{y}\\
t_3 := \frac{{a}^{t}}{a \cdot e^{b}}\\
\mathbf{if}\;t_2 \leq -2.2648629349364475 \cdot 10^{-40}:\\
\;\;\;\;\frac{x \cdot t_3}{y}\\
\mathbf{elif}\;t_2 \leq 2.117665316366963 \cdot 10^{-252}:\\
\;\;\;\;\frac{x}{\frac{y}{t_1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(t_3 \cdot {z}^{y}\right)}{y}\\
\end{array}




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 | 1.9 |
|---|---|
| Target | 11.1 |
| Herbie | 0.4 |
if (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t 1) (log.f64 a))) b))) y) < -2.26486293493644754e-40Initial program 5.8
Applied add-cube-cbrt_binary645.8
Taylor expanded in y around 0 6.6
Simplified11.7
Applied associate-*l/_binary641.6
if -2.26486293493644754e-40 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t 1) (log.f64 a))) b))) y) < 2.11766531636696306e-252Initial program 1.2
Applied associate-/l*_binary640.3
if 2.11766531636696306e-252 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t 1) (log.f64 a))) b))) y) Initial program 6.1
Applied add-cube-cbrt_binary646.1
Applied *-un-lft-identity_binary646.1
Applied associate-/r*_binary646.1
Simplified1.1
Final simplification0.4
herbie shell --seed 2022130
(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))