
(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 14 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 (* x (exp (fma y (- (log z) t) (* a (- (log1p (- z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(fma(y, (log(z) - t), (a * (log1p(-z) - b))));
}
function code(x, y, z, t, a, b) return Float64(x * exp(fma(y, Float64(log(z) - t), Float64(a * Float64(log1p(Float64(-z)) - b))))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}
\end{array}
Initial program 96.9%
fma-def97.3%
sub-neg97.3%
log1p-def99.2%
Simplified99.2%
Final simplification99.2%
(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}
Initial program 96.9%
Final simplification96.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1750.0) (not (<= y 6e+30))) (* x (exp (* y (- (log z) t)))) (* x (exp (* a (- (log1p (- z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1750.0) || !(y <= 6e+30)) {
tmp = x * exp((y * (log(z) - t)));
} else {
tmp = x * exp((a * (log1p(-z) - b)));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1750.0) || !(y <= 6e+30)) {
tmp = x * Math.exp((y * (Math.log(z) - t)));
} else {
tmp = x * Math.exp((a * (Math.log1p(-z) - b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1750.0) or not (y <= 6e+30): tmp = x * math.exp((y * (math.log(z) - t))) else: tmp = x * math.exp((a * (math.log1p(-z) - b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1750.0) || !(y <= 6e+30)) tmp = Float64(x * exp(Float64(y * Float64(log(z) - t)))); else tmp = Float64(x * exp(Float64(a * Float64(log1p(Float64(-z)) - b)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1750.0], N[Not[LessEqual[y, 6e+30]], $MachinePrecision]], N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1750 \lor \neg \left(y \leq 6 \cdot 10^{+30}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}\\
\end{array}
\end{array}
if y < -1750 or 5.99999999999999956e30 < y Initial program 97.5%
Taylor expanded in y around inf 90.0%
if -1750 < y < 5.99999999999999956e30Initial program 96.4%
Taylor expanded in y around 0 83.9%
sub-neg83.9%
sub-neg83.9%
sub-neg83.9%
neg-mul-183.9%
log1p-def88.1%
neg-mul-188.1%
Simplified88.1%
Final simplification89.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -0.106) (not (<= y 2.5e-29))) (* x (exp (* y (- (log z) t)))) (* x (exp (* a (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -0.106) || !(y <= 2.5e-29)) {
tmp = x * exp((y * (log(z) - t)));
} else {
tmp = x * exp((a * -b));
}
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 <= (-0.106d0)) .or. (.not. (y <= 2.5d-29))) then
tmp = x * exp((y * (log(z) - t)))
else
tmp = x * exp((a * -b))
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 <= -0.106) || !(y <= 2.5e-29)) {
tmp = x * Math.exp((y * (Math.log(z) - t)));
} else {
tmp = x * Math.exp((a * -b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -0.106) or not (y <= 2.5e-29): tmp = x * math.exp((y * (math.log(z) - t))) else: tmp = x * math.exp((a * -b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -0.106) || !(y <= 2.5e-29)) tmp = Float64(x * exp(Float64(y * Float64(log(z) - t)))); else tmp = Float64(x * exp(Float64(a * Float64(-b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -0.106) || ~((y <= 2.5e-29))) tmp = x * exp((y * (log(z) - t))); else tmp = x * exp((a * -b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -0.106], N[Not[LessEqual[y, 2.5e-29]], $MachinePrecision]], N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.106 \lor \neg \left(y \leq 2.5 \cdot 10^{-29}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\end{array}
\end{array}
if y < -0.105999999999999997 or 2.49999999999999993e-29 < y Initial program 94.8%
Taylor expanded in y around inf 86.7%
if -0.105999999999999997 < y < 2.49999999999999993e-29Initial program 99.2%
Taylor expanded in b around inf 86.6%
mul-1-neg86.6%
distribute-rgt-neg-out86.6%
Simplified86.6%
Final simplification86.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (exp (* a (- b))))) (t_2 (* x (pow z y))))
(if (<= y -15.5)
t_2
(if (<= y 4.5e-17)
t_1
(if (<= y 2.6e+16)
(* x (pow (/ -1.0 z) (- a)))
(if (<= y 7.5e+37) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * exp((a * -b));
double t_2 = x * pow(z, y);
double tmp;
if (y <= -15.5) {
tmp = t_2;
} else if (y <= 4.5e-17) {
tmp = t_1;
} else if (y <= 2.6e+16) {
tmp = x * pow((-1.0 / z), -a);
} else if (y <= 7.5e+37) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = x * exp((a * -b))
t_2 = x * (z ** y)
if (y <= (-15.5d0)) then
tmp = t_2
else if (y <= 4.5d-17) then
tmp = t_1
else if (y <= 2.6d+16) then
tmp = x * (((-1.0d0) / z) ** -a)
else if (y <= 7.5d+37) then
tmp = t_1
else
tmp = t_2
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 = x * Math.exp((a * -b));
double t_2 = x * Math.pow(z, y);
double tmp;
if (y <= -15.5) {
tmp = t_2;
} else if (y <= 4.5e-17) {
tmp = t_1;
} else if (y <= 2.6e+16) {
tmp = x * Math.pow((-1.0 / z), -a);
} else if (y <= 7.5e+37) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.exp((a * -b)) t_2 = x * math.pow(z, y) tmp = 0 if y <= -15.5: tmp = t_2 elif y <= 4.5e-17: tmp = t_1 elif y <= 2.6e+16: tmp = x * math.pow((-1.0 / z), -a) elif y <= 7.5e+37: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * exp(Float64(a * Float64(-b)))) t_2 = Float64(x * (z ^ y)) tmp = 0.0 if (y <= -15.5) tmp = t_2; elseif (y <= 4.5e-17) tmp = t_1; elseif (y <= 2.6e+16) tmp = Float64(x * (Float64(-1.0 / z) ^ Float64(-a))); elseif (y <= 7.5e+37) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * exp((a * -b)); t_2 = x * (z ^ y); tmp = 0.0; if (y <= -15.5) tmp = t_2; elseif (y <= 4.5e-17) tmp = t_1; elseif (y <= 2.6e+16) tmp = x * ((-1.0 / z) ^ -a); elseif (y <= 7.5e+37) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -15.5], t$95$2, If[LessEqual[y, 4.5e-17], t$95$1, If[LessEqual[y, 2.6e+16], N[(x * N[Power[N[(-1.0 / z), $MachinePrecision], (-a)], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+37], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot e^{a \cdot \left(-b\right)}\\
t_2 := x \cdot {z}^{y}\\
\mathbf{if}\;y \leq -15.5:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+16}:\\
\;\;\;\;x \cdot {\left(\frac{-1}{z}\right)}^{\left(-a\right)}\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if y < -15.5 or 7.5000000000000003e37 < y Initial program 97.4%
Taylor expanded in y around inf 89.8%
Taylor expanded in t around 0 75.4%
if -15.5 < y < 4.49999999999999978e-17 or 2.6e16 < y < 7.5000000000000003e37Initial program 99.2%
Taylor expanded in b around inf 85.3%
mul-1-neg85.3%
distribute-rgt-neg-out85.3%
Simplified85.3%
if 4.49999999999999978e-17 < y < 2.6e16Initial program 50.9%
Taylor expanded in y around 0 15.3%
sub-neg15.3%
sub-neg15.3%
sub-neg15.3%
neg-mul-115.3%
log1p-def63.2%
neg-mul-163.2%
Simplified63.2%
Taylor expanded in b around 0 4.0%
Taylor expanded in z around -inf 0.0%
associate-*r*0.0%
*-commutative0.0%
exp-to-pow75.0%
mul-1-neg75.0%
Simplified75.0%
Final simplification80.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (pow z y))))
(if (<= y -0.027)
t_1
(if (<= y 2.5e-29)
(* x (- 1.0 (* a b)))
(if (<= y 1.25e+29)
(* x (exp (* a b)))
(if (<= y 6e+30) (* x (- 1.0 (* z a))) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * pow(z, y);
double tmp;
if (y <= -0.027) {
tmp = t_1;
} else if (y <= 2.5e-29) {
tmp = x * (1.0 - (a * b));
} else if (y <= 1.25e+29) {
tmp = x * exp((a * b));
} else if (y <= 6e+30) {
tmp = x * (1.0 - (z * a));
} 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 = x * (z ** y)
if (y <= (-0.027d0)) then
tmp = t_1
else if (y <= 2.5d-29) then
tmp = x * (1.0d0 - (a * b))
else if (y <= 1.25d+29) then
tmp = x * exp((a * b))
else if (y <= 6d+30) then
tmp = x * (1.0d0 - (z * a))
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 = x * Math.pow(z, y);
double tmp;
if (y <= -0.027) {
tmp = t_1;
} else if (y <= 2.5e-29) {
tmp = x * (1.0 - (a * b));
} else if (y <= 1.25e+29) {
tmp = x * Math.exp((a * b));
} else if (y <= 6e+30) {
tmp = x * (1.0 - (z * a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.pow(z, y) tmp = 0 if y <= -0.027: tmp = t_1 elif y <= 2.5e-29: tmp = x * (1.0 - (a * b)) elif y <= 1.25e+29: tmp = x * math.exp((a * b)) elif y <= 6e+30: tmp = x * (1.0 - (z * a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * (z ^ y)) tmp = 0.0 if (y <= -0.027) tmp = t_1; elseif (y <= 2.5e-29) tmp = Float64(x * Float64(1.0 - Float64(a * b))); elseif (y <= 1.25e+29) tmp = Float64(x * exp(Float64(a * b))); elseif (y <= 6e+30) tmp = Float64(x * Float64(1.0 - Float64(z * a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * (z ^ y); tmp = 0.0; if (y <= -0.027) tmp = t_1; elseif (y <= 2.5e-29) tmp = x * (1.0 - (a * b)); elseif (y <= 1.25e+29) tmp = x * exp((a * b)); elseif (y <= 6e+30) tmp = x * (1.0 - (z * a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.027], t$95$1, If[LessEqual[y, 2.5e-29], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+29], N[(x * N[Exp[N[(a * b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+30], N[(x * N[(1.0 - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot {z}^{y}\\
\mathbf{if}\;y \leq -0.027:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-29}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+29}:\\
\;\;\;\;x \cdot e^{a \cdot b}\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \left(1 - z \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -0.0269999999999999997 or 5.99999999999999956e30 < y Initial program 97.5%
Taylor expanded in y around inf 90.0%
Taylor expanded in t around 0 75.0%
if -0.0269999999999999997 < y < 2.49999999999999993e-29Initial program 99.2%
Taylor expanded in b around inf 86.6%
mul-1-neg86.6%
distribute-rgt-neg-out86.6%
Simplified86.6%
Taylor expanded in a around 0 48.1%
mul-1-neg48.1%
unsub-neg48.1%
Simplified48.1%
if 2.49999999999999993e-29 < y < 1.25e29Initial program 69.8%
expm1-log1p-u69.8%
fma-def69.8%
sub-neg69.8%
log1p-udef100.0%
add-sqr-sqrt0.0%
sqrt-unprod62.1%
sqr-neg62.1%
sqrt-unprod62.1%
add-sqr-sqrt62.1%
Applied egg-rr62.1%
Taylor expanded in b around inf 32.9%
mul-1-neg32.9%
distribute-rgt-neg-in32.9%
Simplified32.9%
expm1-log1p-u32.9%
add-sqr-sqrt9.2%
sqrt-unprod25.4%
sqr-neg25.4%
sqrt-unprod16.1%
add-sqr-sqrt55.6%
Applied egg-rr55.6%
if 1.25e29 < y < 5.99999999999999956e30Initial program 100.0%
Taylor expanded in y around 0 100.0%
sub-neg100.0%
sub-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
log1p-def100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in b around 0 52.5%
Taylor expanded in z around 0 52.5%
mul-1-neg52.5%
unsub-neg52.5%
Simplified52.5%
Final simplification60.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.35e-9) (not (<= t 1e-26))) (* x (exp (* y (- t)))) (* x (pow z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.35e-9) || !(t <= 1e-26)) {
tmp = x * exp((y * -t));
} else {
tmp = x * pow(z, 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
real(8) :: tmp
if ((t <= (-1.35d-9)) .or. (.not. (t <= 1d-26))) then
tmp = x * exp((y * -t))
else
tmp = x * (z ** y)
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 ((t <= -1.35e-9) || !(t <= 1e-26)) {
tmp = x * Math.exp((y * -t));
} else {
tmp = x * Math.pow(z, y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.35e-9) or not (t <= 1e-26): tmp = x * math.exp((y * -t)) else: tmp = x * math.pow(z, y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.35e-9) || !(t <= 1e-26)) tmp = Float64(x * exp(Float64(y * Float64(-t)))); else tmp = Float64(x * (z ^ y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.35e-9) || ~((t <= 1e-26))) tmp = x * exp((y * -t)); else tmp = x * (z ^ y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.35e-9], N[Not[LessEqual[t, 1e-26]], $MachinePrecision]], N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{-9} \lor \neg \left(t \leq 10^{-26}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\end{array}
if t < -1.3500000000000001e-9 or 1e-26 < t Initial program 96.6%
Taylor expanded in t around inf 75.0%
mul-1-neg75.0%
*-commutative75.0%
Simplified75.0%
if -1.3500000000000001e-9 < t < 1e-26Initial program 97.2%
Taylor expanded in y around inf 64.9%
Taylor expanded in t around 0 64.9%
Final simplification69.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.95) (not (<= y 1.9e+39))) (* x (pow z y)) (* x (exp (* a (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.95) || !(y <= 1.9e+39)) {
tmp = x * pow(z, y);
} else {
tmp = x * exp((a * -b));
}
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 <= (-1.95d0)) .or. (.not. (y <= 1.9d+39))) then
tmp = x * (z ** y)
else
tmp = x * exp((a * -b))
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 <= -1.95) || !(y <= 1.9e+39)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x * Math.exp((a * -b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.95) or not (y <= 1.9e+39): tmp = x * math.pow(z, y) else: tmp = x * math.exp((a * -b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.95) || !(y <= 1.9e+39)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * exp(Float64(a * Float64(-b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.95) || ~((y <= 1.9e+39))) tmp = x * (z ^ y); else tmp = x * exp((a * -b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.95], N[Not[LessEqual[y, 1.9e+39]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \lor \neg \left(y \leq 1.9 \cdot 10^{+39}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\end{array}
\end{array}
if y < -1.94999999999999996 or 1.8999999999999999e39 < y Initial program 97.4%
Taylor expanded in y around inf 89.8%
Taylor expanded in t around 0 75.4%
if -1.94999999999999996 < y < 1.8999999999999999e39Initial program 96.5%
Taylor expanded in b around inf 81.3%
mul-1-neg81.3%
distribute-rgt-neg-out81.3%
Simplified81.3%
Final simplification78.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -0.06) (not (<= y 2.5e-29))) (* x (pow z y)) (* x (- 1.0 (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -0.06) || !(y <= 2.5e-29)) {
tmp = x * pow(z, y);
} else {
tmp = x * (1.0 - (a * b));
}
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 <= (-0.06d0)) .or. (.not. (y <= 2.5d-29))) then
tmp = x * (z ** y)
else
tmp = x * (1.0d0 - (a * b))
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 <= -0.06) || !(y <= 2.5e-29)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x * (1.0 - (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -0.06) or not (y <= 2.5e-29): tmp = x * math.pow(z, y) else: tmp = x * (1.0 - (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -0.06) || !(y <= 2.5e-29)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * Float64(1.0 - Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -0.06) || ~((y <= 2.5e-29))) tmp = x * (z ^ y); else tmp = x * (1.0 - (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -0.06], N[Not[LessEqual[y, 2.5e-29]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.06 \lor \neg \left(y \leq 2.5 \cdot 10^{-29}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\end{array}
\end{array}
if y < -0.059999999999999998 or 2.49999999999999993e-29 < y Initial program 94.8%
Taylor expanded in y around inf 86.7%
Taylor expanded in t around 0 69.7%
if -0.059999999999999998 < y < 2.49999999999999993e-29Initial program 99.2%
Taylor expanded in b around inf 86.6%
mul-1-neg86.6%
distribute-rgt-neg-out86.6%
Simplified86.6%
Taylor expanded in a around 0 48.1%
mul-1-neg48.1%
unsub-neg48.1%
Simplified48.1%
Final simplification59.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -3.4e+162) (not (<= a 1.05e-54))) (* (- a) (* x b)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -3.4e+162) || !(a <= 1.05e-54)) {
tmp = -a * (x * b);
} else {
tmp = 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 ((a <= (-3.4d+162)) .or. (.not. (a <= 1.05d-54))) then
tmp = -a * (x * b)
else
tmp = 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 ((a <= -3.4e+162) || !(a <= 1.05e-54)) {
tmp = -a * (x * b);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -3.4e+162) or not (a <= 1.05e-54): tmp = -a * (x * b) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -3.4e+162) || !(a <= 1.05e-54)) tmp = Float64(Float64(-a) * Float64(x * b)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -3.4e+162) || ~((a <= 1.05e-54))) tmp = -a * (x * b); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -3.4e+162], N[Not[LessEqual[a, 1.05e-54]], $MachinePrecision]], N[((-a) * N[(x * b), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.4 \cdot 10^{+162} \lor \neg \left(a \leq 1.05 \cdot 10^{-54}\right):\\
\;\;\;\;\left(-a\right) \cdot \left(x \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.40000000000000003e162 or 1.05e-54 < a Initial program 94.2%
Taylor expanded in b around inf 72.3%
mul-1-neg72.3%
distribute-rgt-neg-out72.3%
Simplified72.3%
Taylor expanded in a around 0 29.2%
mul-1-neg29.2%
unsub-neg29.2%
Simplified29.2%
Taylor expanded in a around inf 24.5%
mul-1-neg24.5%
distribute-rgt-neg-in24.5%
Simplified24.5%
if -3.40000000000000003e162 < a < 1.05e-54Initial program 99.3%
Taylor expanded in t around inf 62.6%
mul-1-neg62.6%
*-commutative62.6%
Simplified62.6%
Taylor expanded in y around 0 31.7%
Final simplification28.3%
(FPCore (x y z t a b) :precision binary64 (if (<= t 1.02e+96) (* x (- 1.0 (* a b))) (* (* y t) (- x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 1.02e+96) {
tmp = x * (1.0 - (a * b));
} else {
tmp = (y * 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 (t <= 1.02d+96) then
tmp = x * (1.0d0 - (a * b))
else
tmp = (y * 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 (t <= 1.02e+96) {
tmp = x * (1.0 - (a * b));
} else {
tmp = (y * t) * -x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= 1.02e+96: tmp = x * (1.0 - (a * b)) else: tmp = (y * t) * -x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 1.02e+96) tmp = Float64(x * Float64(1.0 - Float64(a * b))); else tmp = Float64(Float64(y * t) * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= 1.02e+96) tmp = x * (1.0 - (a * b)); else tmp = (y * t) * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 1.02e+96], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * t), $MachinePrecision] * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.02 \cdot 10^{+96}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot t\right) \cdot \left(-x\right)\\
\end{array}
\end{array}
if t < 1.02000000000000001e96Initial program 97.8%
Taylor expanded in b around inf 64.3%
mul-1-neg64.3%
distribute-rgt-neg-out64.3%
Simplified64.3%
Taylor expanded in a around 0 35.4%
mul-1-neg35.4%
unsub-neg35.4%
Simplified35.4%
if 1.02000000000000001e96 < t Initial program 91.7%
Taylor expanded in t around inf 78.3%
mul-1-neg78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in y around 0 18.6%
mul-1-neg18.6%
unsub-neg18.6%
*-commutative18.6%
Simplified18.6%
Taylor expanded in t around inf 21.2%
mul-1-neg21.2%
*-commutative21.2%
associate-*r*21.4%
*-commutative21.4%
distribute-rgt-neg-out21.4%
distribute-rgt-neg-in21.4%
Simplified21.4%
Final simplification33.4%
(FPCore (x y z t a b) :precision binary64 (if (<= a 1.15e-24) x (* x (* y t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= 1.15e-24) {
tmp = x;
} else {
tmp = x * (y * t);
}
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 (a <= 1.15d-24) then
tmp = x
else
tmp = x * (y * t)
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 (a <= 1.15e-24) {
tmp = x;
} else {
tmp = x * (y * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= 1.15e-24: tmp = x else: tmp = x * (y * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= 1.15e-24) tmp = x; else tmp = Float64(x * Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= 1.15e-24) tmp = x; else tmp = x * (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, 1.15e-24], x, N[(x * N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.15 \cdot 10^{-24}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot t\right)\\
\end{array}
\end{array}
if a < 1.1500000000000001e-24Initial program 98.4%
Taylor expanded in t around inf 56.4%
mul-1-neg56.4%
*-commutative56.4%
Simplified56.4%
Taylor expanded in y around 0 24.7%
if 1.1500000000000001e-24 < a Initial program 93.1%
Taylor expanded in t around inf 38.3%
mul-1-neg38.3%
*-commutative38.3%
Simplified38.3%
Taylor expanded in y around 0 12.6%
mul-1-neg12.6%
unsub-neg12.6%
*-commutative12.6%
Simplified12.6%
Taylor expanded in t around inf 19.1%
mul-1-neg19.1%
*-commutative19.1%
associate-*r*19.2%
*-commutative19.2%
distribute-rgt-neg-out19.2%
distribute-rgt-neg-in19.2%
Simplified19.2%
expm1-log1p-u17.4%
expm1-udef29.1%
add-sqr-sqrt8.8%
sqrt-unprod32.8%
sqr-neg32.8%
sqrt-unprod17.2%
add-sqr-sqrt24.8%
Applied egg-rr24.8%
expm1-def13.0%
expm1-log1p13.4%
Simplified13.4%
Final simplification21.5%
(FPCore (x y z t a b) :precision binary64 (if (<= a 4.6e-54) x (* y (* x t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= 4.6e-54) {
tmp = x;
} else {
tmp = y * (x * t);
}
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 (a <= 4.6d-54) then
tmp = x
else
tmp = y * (x * t)
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 (a <= 4.6e-54) {
tmp = x;
} else {
tmp = y * (x * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= 4.6e-54: tmp = x else: tmp = y * (x * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= 4.6e-54) tmp = x; else tmp = Float64(y * Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= 4.6e-54) tmp = x; else tmp = y * (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, 4.6e-54], x, N[(y * N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 4.6 \cdot 10^{-54}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot t\right)\\
\end{array}
\end{array}
if a < 4.5999999999999998e-54Initial program 98.3%
Taylor expanded in t around inf 56.8%
mul-1-neg56.8%
*-commutative56.8%
Simplified56.8%
Taylor expanded in y around 0 25.3%
if 4.5999999999999998e-54 < a Initial program 93.6%
Taylor expanded in t around inf 38.5%
mul-1-neg38.5%
*-commutative38.5%
Simplified38.5%
Taylor expanded in y around 0 14.5%
mul-1-neg14.5%
unsub-neg14.5%
*-commutative14.5%
Simplified14.5%
Taylor expanded in t around inf 20.7%
mul-1-neg20.7%
*-commutative20.7%
associate-*r*20.8%
*-commutative20.8%
distribute-rgt-neg-out20.8%
distribute-rgt-neg-in20.8%
Simplified20.8%
expm1-log1p-u19.1%
expm1-udef33.7%
add-sqr-sqrt8.3%
sqrt-unprod34.6%
sqr-neg34.6%
sqrt-unprod19.9%
add-sqr-sqrt27.1%
Applied egg-rr27.1%
expm1-def12.4%
expm1-log1p12.7%
associate-*r*17.6%
Simplified17.6%
Final simplification23.0%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return 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 = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 96.9%
Taylor expanded in t around inf 51.3%
mul-1-neg51.3%
*-commutative51.3%
Simplified51.3%
Taylor expanded in y around 0 19.2%
Final simplification19.2%
herbie shell --seed 2024018
(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))))))