
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
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)) + (a * (log((1.0d0 - z)) - b))))
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)) + (a * (Math.log((1.0 - z)) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
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)) + (a * (log((1.0d0 - z)) - b))))
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)) + (a * (Math.log((1.0 - z)) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
(FPCore (x y z t a b) :precision binary64 (* (exp (+ (* (- (log (- 1.0 z)) b) a) (* (- (log z) t) y))) x))
double code(double x, double y, double z, double t, double a, double b) {
return exp((((log((1.0 - z)) - b) * a) + ((log(z) - t) * y))) * x;
}
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 = exp((((log((1.0d0 - z)) - b) * a) + ((log(z) - t) * y))) * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.exp((((Math.log((1.0 - z)) - b) * a) + ((Math.log(z) - t) * y))) * x;
}
def code(x, y, z, t, a, b): return math.exp((((math.log((1.0 - z)) - b) * a) + ((math.log(z) - t) * y))) * x
function code(x, y, z, t, a, b) return Float64(exp(Float64(Float64(Float64(log(Float64(1.0 - z)) - b) * a) + Float64(Float64(log(z) - t) * y))) * x) end
function tmp = code(x, y, z, t, a, b) tmp = exp((((log((1.0 - z)) - b) * a) + ((log(z) - t) * y))) * x; end
code[x_, y_, z_, t_, a_, b_] := N[(N[Exp[N[(N[(N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * a), $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
e^{\left(\log \left(1 - z\right) - b\right) \cdot a + \left(\log z - t\right) \cdot y} \cdot x
\end{array}
Initial program 96.9%
Final simplification96.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (- (log z) t) y)) x)))
(if (<= y -7.2e-60)
t_1
(if (<= y 9e+24) (* (exp (* (- (- z) b) a)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp(((log(z) - t) * y)) * x;
double tmp;
if (y <= -7.2e-60) {
tmp = t_1;
} else if (y <= 9e+24) {
tmp = exp(((-z - b) * a)) * x;
} else {
tmp = t_1;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = exp(((log(z) - t) * y)) * x
if (y <= (-7.2d-60)) then
tmp = t_1
else if (y <= 9d+24) then
tmp = exp(((-z - b) * a)) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.exp(((Math.log(z) - t) * y)) * x;
double tmp;
if (y <= -7.2e-60) {
tmp = t_1;
} else if (y <= 9e+24) {
tmp = Math.exp(((-z - b) * a)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp(((math.log(z) - t) * y)) * x tmp = 0 if y <= -7.2e-60: tmp = t_1 elif y <= 9e+24: tmp = math.exp(((-z - b) * a)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(log(z) - t) * y)) * x) tmp = 0.0 if (y <= -7.2e-60) tmp = t_1; elseif (y <= 9e+24) tmp = Float64(exp(Float64(Float64(Float64(-z) - b) * a)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp(((log(z) - t) * y)) * x; tmp = 0.0; if (y <= -7.2e-60) tmp = t_1; elseif (y <= 9e+24) tmp = exp(((-z - b) * a)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -7.2e-60], t$95$1, If[LessEqual[y, 9e+24], N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(\log z - t\right) \cdot y} \cdot x\\
\mathbf{if}\;y \leq -7.2 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+24}:\\
\;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.2e-60 or 9.00000000000000039e24 < y Initial program 98.4%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6489.8
Applied rewrites89.8%
if -7.2e-60 < y < 9.00000000000000039e24Initial program 95.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6487.5
Applied rewrites87.5%
Taylor expanded in z around 0
Applied rewrites87.5%
Final simplification88.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= y -1e-25)
(* (exp (* (log z) y)) x)
(if (<= y 6.2e+69)
(* (exp (* (- (- z) b) a)) x)
(* (exp (* (* (/ y t) t) (- t))) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1e-25) {
tmp = exp((log(z) * y)) * x;
} else if (y <= 6.2e+69) {
tmp = exp(((-z - b) * a)) * x;
} else {
tmp = exp((((y / t) * t) * -t)) * x;
}
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
real(8) :: tmp
if (y <= (-1d-25)) then
tmp = exp((log(z) * y)) * x
else if (y <= 6.2d+69) then
tmp = exp(((-z - b) * a)) * x
else
tmp = exp((((y / t) * t) * -t)) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1e-25) {
tmp = Math.exp((Math.log(z) * y)) * x;
} else if (y <= 6.2e+69) {
tmp = Math.exp(((-z - b) * a)) * x;
} else {
tmp = Math.exp((((y / t) * t) * -t)) * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1e-25: tmp = math.exp((math.log(z) * y)) * x elif y <= 6.2e+69: tmp = math.exp(((-z - b) * a)) * x else: tmp = math.exp((((y / t) * t) * -t)) * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1e-25) tmp = Float64(exp(Float64(log(z) * y)) * x); elseif (y <= 6.2e+69) tmp = Float64(exp(Float64(Float64(Float64(-z) - b) * a)) * x); else tmp = Float64(exp(Float64(Float64(Float64(y / t) * t) * Float64(-t))) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1e-25) tmp = exp((log(z) * y)) * x; elseif (y <= 6.2e+69) tmp = exp(((-z - b) * a)) * x; else tmp = exp((((y / t) * t) * -t)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1e-25], N[(N[Exp[N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 6.2e+69], N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], N[(N[Exp[N[(N[(N[(y / t), $MachinePrecision] * t), $MachinePrecision] * (-t)), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-25}:\\
\;\;\;\;e^{\log z \cdot y} \cdot x\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+69}:\\
\;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\frac{y}{t} \cdot t\right) \cdot \left(-t\right)} \cdot x\\
\end{array}
\end{array}
if y < -1.00000000000000004e-25Initial program 96.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6487.3
Applied rewrites87.3%
Taylor expanded in t around 0
Applied rewrites71.5%
if -1.00000000000000004e-25 < y < 6.1999999999999997e69Initial program 96.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6482.8
Applied rewrites82.8%
Taylor expanded in z around 0
Applied rewrites82.8%
if 6.1999999999999997e69 < y Initial program 100.0%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6479.1
Applied rewrites79.1%
Applied rewrites79.1%
Applied rewrites90.7%
Final simplification81.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (* (/ y t) t) (- t))) x)))
(if (<= y -7.2e-60)
t_1
(if (<= y 6.2e+69) (* (exp (* (- (- z) b) a)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp((((y / t) * t) * -t)) * x;
double tmp;
if (y <= -7.2e-60) {
tmp = t_1;
} else if (y <= 6.2e+69) {
tmp = exp(((-z - b) * a)) * x;
} else {
tmp = t_1;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = exp((((y / t) * t) * -t)) * x
if (y <= (-7.2d-60)) then
tmp = t_1
else if (y <= 6.2d+69) then
tmp = exp(((-z - b) * a)) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.exp((((y / t) * t) * -t)) * x;
double tmp;
if (y <= -7.2e-60) {
tmp = t_1;
} else if (y <= 6.2e+69) {
tmp = Math.exp(((-z - b) * a)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp((((y / t) * t) * -t)) * x tmp = 0 if y <= -7.2e-60: tmp = t_1 elif y <= 6.2e+69: tmp = math.exp(((-z - b) * a)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(Float64(y / t) * t) * Float64(-t))) * x) tmp = 0.0 if (y <= -7.2e-60) tmp = t_1; elseif (y <= 6.2e+69) tmp = Float64(exp(Float64(Float64(Float64(-z) - b) * a)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp((((y / t) * t) * -t)) * x; tmp = 0.0; if (y <= -7.2e-60) tmp = t_1; elseif (y <= 6.2e+69) tmp = exp(((-z - b) * a)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[(N[(N[(y / t), $MachinePrecision] * t), $MachinePrecision] * (-t)), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -7.2e-60], t$95$1, If[LessEqual[y, 6.2e+69], N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(\frac{y}{t} \cdot t\right) \cdot \left(-t\right)} \cdot x\\
\mathbf{if}\;y \leq -7.2 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+69}:\\
\;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.2e-60 or 6.1999999999999997e69 < y Initial program 98.2%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6464.5
Applied rewrites64.5%
Applied rewrites62.0%
Applied rewrites73.6%
if -7.2e-60 < y < 6.1999999999999997e69Initial program 95.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6484.4
Applied rewrites84.4%
Taylor expanded in z around 0
Applied rewrites84.4%
Final simplification79.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (exp (* (- (- z) b) a)) x))) (if (<= a -2.9e-42) t_1 (if (<= a 7.5e-123) (* (exp (* (- t) y)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp(((-z - b) * a)) * x;
double tmp;
if (a <= -2.9e-42) {
tmp = t_1;
} else if (a <= 7.5e-123) {
tmp = exp((-t * y)) * x;
} else {
tmp = t_1;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = exp(((-z - b) * a)) * x
if (a <= (-2.9d-42)) then
tmp = t_1
else if (a <= 7.5d-123) then
tmp = exp((-t * y)) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.exp(((-z - b) * a)) * x;
double tmp;
if (a <= -2.9e-42) {
tmp = t_1;
} else if (a <= 7.5e-123) {
tmp = Math.exp((-t * y)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp(((-z - b) * a)) * x tmp = 0 if a <= -2.9e-42: tmp = t_1 elif a <= 7.5e-123: tmp = math.exp((-t * y)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(Float64(-z) - b) * a)) * x) tmp = 0.0 if (a <= -2.9e-42) tmp = t_1; elseif (a <= 7.5e-123) tmp = Float64(exp(Float64(Float64(-t) * y)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp(((-z - b) * a)) * x; tmp = 0.0; if (a <= -2.9e-42) tmp = t_1; elseif (a <= 7.5e-123) tmp = exp((-t * y)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[a, -2.9e-42], t$95$1, If[LessEqual[a, 7.5e-123], N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
\mathbf{if}\;a \leq -2.9 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 7.5 \cdot 10^{-123}:\\
\;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.9000000000000003e-42 or 7.50000000000000011e-123 < a Initial program 94.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6483.4
Applied rewrites83.4%
Taylor expanded in z around 0
Applied rewrites83.4%
if -2.9000000000000003e-42 < a < 7.50000000000000011e-123Initial program 99.9%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6473.3
Applied rewrites73.3%
Final simplification79.3%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (exp (* (- b) a)) x))) (if (<= a -2.9e-42) t_1 (if (<= a 7.5e-123) (* (exp (* (- t) y)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp((-b * a)) * x;
double tmp;
if (a <= -2.9e-42) {
tmp = t_1;
} else if (a <= 7.5e-123) {
tmp = exp((-t * y)) * x;
} else {
tmp = t_1;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = exp((-b * a)) * x
if (a <= (-2.9d-42)) then
tmp = t_1
else if (a <= 7.5d-123) then
tmp = exp((-t * y)) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.exp((-b * a)) * x;
double tmp;
if (a <= -2.9e-42) {
tmp = t_1;
} else if (a <= 7.5e-123) {
tmp = Math.exp((-t * y)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp((-b * a)) * x tmp = 0 if a <= -2.9e-42: tmp = t_1 elif a <= 7.5e-123: tmp = math.exp((-t * y)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(-b) * a)) * x) tmp = 0.0 if (a <= -2.9e-42) tmp = t_1; elseif (a <= 7.5e-123) tmp = Float64(exp(Float64(Float64(-t) * y)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp((-b * a)) * x; tmp = 0.0; if (a <= -2.9e-42) tmp = t_1; elseif (a <= 7.5e-123) tmp = exp((-t * y)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[a, -2.9e-42], t$95$1, If[LessEqual[a, 7.5e-123], N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(-b\right) \cdot a} \cdot x\\
\mathbf{if}\;a \leq -2.9 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 7.5 \cdot 10^{-123}:\\
\;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.9000000000000003e-42 or 7.50000000000000011e-123 < a Initial program 94.8%
Taylor expanded in b around inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6476.4
Applied rewrites76.4%
if -2.9000000000000003e-42 < a < 7.50000000000000011e-123Initial program 99.9%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6473.3
Applied rewrites73.3%
Final simplification75.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (exp (* (- b) a)) x))) (if (<= b -9.2e-153) t_1 (if (<= b 2e-199) (* (exp (* (- z) a)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp((-b * a)) * x;
double tmp;
if (b <= -9.2e-153) {
tmp = t_1;
} else if (b <= 2e-199) {
tmp = exp((-z * a)) * x;
} else {
tmp = t_1;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = exp((-b * a)) * x
if (b <= (-9.2d-153)) then
tmp = t_1
else if (b <= 2d-199) then
tmp = exp((-z * a)) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.exp((-b * a)) * x;
double tmp;
if (b <= -9.2e-153) {
tmp = t_1;
} else if (b <= 2e-199) {
tmp = Math.exp((-z * a)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp((-b * a)) * x tmp = 0 if b <= -9.2e-153: tmp = t_1 elif b <= 2e-199: tmp = math.exp((-z * a)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(-b) * a)) * x) tmp = 0.0 if (b <= -9.2e-153) tmp = t_1; elseif (b <= 2e-199) tmp = Float64(exp(Float64(Float64(-z) * a)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp((-b * a)) * x; tmp = 0.0; if (b <= -9.2e-153) tmp = t_1; elseif (b <= 2e-199) tmp = exp((-z * a)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[b, -9.2e-153], t$95$1, If[LessEqual[b, 2e-199], N[(N[Exp[N[((-z) * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(-b\right) \cdot a} \cdot x\\
\mathbf{if}\;b \leq -9.2 \cdot 10^{-153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 2 \cdot 10^{-199}:\\
\;\;\;\;e^{\left(-z\right) \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -9.19999999999999988e-153 or 1.99999999999999996e-199 < b Initial program 99.0%
Taylor expanded in b around inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6466.7
Applied rewrites66.7%
if -9.19999999999999988e-153 < b < 1.99999999999999996e-199Initial program 90.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6452.7
Applied rewrites52.7%
Taylor expanded in z around 0
Applied rewrites52.7%
Taylor expanded in b around 0
Applied rewrites51.1%
Final simplification63.1%
(FPCore (x y z t a b) :precision binary64 (if (<= b -3.1e-61) (* (exp (* a z)) x) (* (exp (* (- z) a)) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.1e-61) {
tmp = exp((a * z)) * x;
} else {
tmp = exp((-z * a)) * x;
}
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
real(8) :: tmp
if (b <= (-3.1d-61)) then
tmp = exp((a * z)) * x
else
tmp = exp((-z * a)) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.1e-61) {
tmp = Math.exp((a * z)) * x;
} else {
tmp = Math.exp((-z * a)) * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -3.1e-61: tmp = math.exp((a * z)) * x else: tmp = math.exp((-z * a)) * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -3.1e-61) tmp = Float64(exp(Float64(a * z)) * x); else tmp = Float64(exp(Float64(Float64(-z) * a)) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -3.1e-61) tmp = exp((a * z)) * x; else tmp = exp((-z * a)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.1e-61], N[(N[Exp[N[(a * z), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], N[(N[Exp[N[((-z) * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.1 \cdot 10^{-61}:\\
\;\;\;\;e^{a \cdot z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;e^{\left(-z\right) \cdot a} \cdot x\\
\end{array}
\end{array}
if b < -3.09999999999999995e-61Initial program 98.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6472.8
Applied rewrites72.8%
Taylor expanded in z around 0
Applied rewrites72.8%
Taylor expanded in b around 0
Applied rewrites10.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6410.2
Applied rewrites29.5%
if -3.09999999999999995e-61 < b Initial program 95.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6458.8
Applied rewrites58.8%
Taylor expanded in z around 0
Applied rewrites58.8%
Taylor expanded in b around 0
Applied rewrites44.9%
Final simplification39.4%
(FPCore (x y z t a b) :precision binary64 (* (exp (* a z)) x))
double code(double x, double y, double z, double t, double a, double b) {
return exp((a * z)) * x;
}
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 = exp((a * z)) * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.exp((a * z)) * x;
}
def code(x, y, z, t, a, b): return math.exp((a * z)) * x
function code(x, y, z, t, a, b) return Float64(exp(Float64(a * z)) * x) end
function tmp = code(x, y, z, t, a, b) tmp = exp((a * z)) * x; end
code[x_, y_, z_, t_, a_, b_] := N[(N[Exp[N[(a * z), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
e^{a \cdot z} \cdot x
\end{array}
Initial program 96.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6463.9
Applied rewrites63.9%
Taylor expanded in z around 0
Applied rewrites63.9%
Taylor expanded in b around 0
Applied rewrites32.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6432.5
Applied rewrites27.1%
herbie shell --seed 2024276
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B"
:precision binary64
(* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))