(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 (+ (* (log z) y) (* (log a) t))))
(if (<= (log a) -54.988702570892116)
(/ (* (exp (- t_1 (+ (log a) b))) x) y)
(* (exp (- t_1 b)) (/ x (* a 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 = (log(z) * y) + (log(a) * t);
double tmp;
if (log(a) <= -54.988702570892116) {
tmp = (exp((t_1 - (log(a) + b))) * x) / y;
} else {
tmp = exp((t_1 - b)) * (x / (a * 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) :: tmp
t_1 = (log(z) * y) + (log(a) * t)
if (log(a) <= (-54.988702570892116d0)) then
tmp = (exp((t_1 - (log(a) + b))) * x) / y
else
tmp = exp((t_1 - b)) * (x / (a * 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.log(z) * y) + (Math.log(a) * t);
double tmp;
if (Math.log(a) <= -54.988702570892116) {
tmp = (Math.exp((t_1 - (Math.log(a) + b))) * x) / y;
} else {
tmp = Math.exp((t_1 - b)) * (x / (a * 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.log(z) * y) + (math.log(a) * t) tmp = 0 if math.log(a) <= -54.988702570892116: tmp = (math.exp((t_1 - (math.log(a) + b))) * x) / y else: tmp = math.exp((t_1 - b)) * (x / (a * 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 = Float64(Float64(log(z) * y) + Float64(log(a) * t)) tmp = 0.0 if (log(a) <= -54.988702570892116) tmp = Float64(Float64(exp(Float64(t_1 - Float64(log(a) + b))) * x) / y); else tmp = Float64(exp(Float64(t_1 - b)) * Float64(x / Float64(a * 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 = (log(z) * y) + (log(a) * t); tmp = 0.0; if (log(a) <= -54.988702570892116) tmp = (exp((t_1 - (log(a) + b))) * x) / y; else tmp = exp((t_1 - b)) * (x / (a * 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[(N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision] + N[(N[Log[a], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Log[a], $MachinePrecision], -54.988702570892116], N[(N[(N[Exp[N[(t$95$1 - N[(N[Log[a], $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision], N[(N[Exp[N[(t$95$1 - b), $MachinePrecision]], $MachinePrecision] * N[(x / N[(a * y), $MachinePrecision]), $MachinePrecision]), $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 := \log z \cdot y + \log a \cdot t\\
\mathbf{if}\;\log a \leq -54.988702570892116:\\
\;\;\;\;\frac{e^{t_1 - \left(\log a + b\right)} \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;e^{t_1 - b} \cdot \frac{x}{a \cdot 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 | 2.1 |
|---|---|
| Target | 10.6 |
| Herbie | 1.4 |
if (log.f64 a) < -54.988702570892116Initial program 0.7
Taylor expanded in x around 0 0.7
if -54.988702570892116 < (log.f64 a) Initial program 3.2
Taylor expanded in y around inf 3.2
Simplified18.1
Applied egg-rr15.9
Taylor expanded in a around inf 15.9
Simplified1.9
Final simplification1.4
herbie shell --seed 2022153
(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))