
(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 8 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 (- (* y (- (log z) t)) (* a (+ z b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) - (a * (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 * (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 * (z + b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) - (a * (z + b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) - Float64(a * Float64(z + b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) - (a * (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[(z + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) - a \cdot \left(z + b\right)}
\end{array}
Initial program 96.1%
Taylor expanded in z around 0 99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-lft-out99.9%
mul-1-neg99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.3e+30) (not (<= y 0.62))) (* x (pow (/ z (exp t)) y)) (* x (exp (- (* a (- (- b) z)) (* y t))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4.3e+30) || !(y <= 0.62)) {
tmp = x * pow((z / exp(t)), y);
} else {
tmp = x * exp(((a * (-b - z)) - (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 ((y <= (-4.3d+30)) .or. (.not. (y <= 0.62d0))) then
tmp = x * ((z / exp(t)) ** y)
else
tmp = x * exp(((a * (-b - z)) - (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 ((y <= -4.3e+30) || !(y <= 0.62)) {
tmp = x * Math.pow((z / Math.exp(t)), y);
} else {
tmp = x * Math.exp(((a * (-b - z)) - (y * t)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4.3e+30) or not (y <= 0.62): tmp = x * math.pow((z / math.exp(t)), y) else: tmp = x * math.exp(((a * (-b - z)) - (y * t))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -4.3e+30) || !(y <= 0.62)) tmp = Float64(x * (Float64(z / exp(t)) ^ y)); else tmp = Float64(x * exp(Float64(Float64(a * Float64(Float64(-b) - z)) - Float64(y * t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -4.3e+30) || ~((y <= 0.62))) tmp = x * ((z / exp(t)) ^ y); else tmp = x * exp(((a * (-b - z)) - (y * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -4.3e+30], N[Not[LessEqual[y, 0.62]], $MachinePrecision]], N[(x * N[Power[N[(z / N[Exp[t], $MachinePrecision]), $MachinePrecision], y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(N[(a * N[((-b) - z), $MachinePrecision]), $MachinePrecision] - N[(y * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.3 \cdot 10^{+30} \lor \neg \left(y \leq 0.62\right):\\
\;\;\;\;x \cdot {\left(\frac{z}{e^{t}}\right)}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-b\right) - z\right) - y \cdot t}\\
\end{array}
\end{array}
if y < -4.3e30 or 0.619999999999999996 < y Initial program 99.0%
Taylor expanded in a around 0 90.3%
*-commutative90.3%
exp-prod90.3%
exp-diff90.3%
rem-exp-log90.3%
Simplified90.3%
if -4.3e30 < y < 0.619999999999999996Initial program 94.2%
Taylor expanded in z around 0 99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-lft-out99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 98.7%
mul-1-neg98.7%
distribute-lft-neg-out98.7%
*-commutative98.7%
Simplified98.7%
Final simplification95.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (pow z y))) (t_2 (* x (exp (* y (- t))))))
(if (<= y -5.4e+192)
t_2
(if (<= y -4.3e+30)
t_1
(if (<= y 1.42e-163)
(* x (exp (* a (- b))))
(if (or (<= y 1e-5) (not (<= y 4.6e+153))) t_2 t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * pow(z, y);
double t_2 = x * exp((y * -t));
double tmp;
if (y <= -5.4e+192) {
tmp = t_2;
} else if (y <= -4.3e+30) {
tmp = t_1;
} else if (y <= 1.42e-163) {
tmp = x * exp((a * -b));
} else if ((y <= 1e-5) || !(y <= 4.6e+153)) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = x * (z ** y)
t_2 = x * exp((y * -t))
if (y <= (-5.4d+192)) then
tmp = t_2
else if (y <= (-4.3d+30)) then
tmp = t_1
else if (y <= 1.42d-163) then
tmp = x * exp((a * -b))
else if ((y <= 1d-5) .or. (.not. (y <= 4.6d+153))) then
tmp = t_2
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 t_2 = x * Math.exp((y * -t));
double tmp;
if (y <= -5.4e+192) {
tmp = t_2;
} else if (y <= -4.3e+30) {
tmp = t_1;
} else if (y <= 1.42e-163) {
tmp = x * Math.exp((a * -b));
} else if ((y <= 1e-5) || !(y <= 4.6e+153)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.pow(z, y) t_2 = x * math.exp((y * -t)) tmp = 0 if y <= -5.4e+192: tmp = t_2 elif y <= -4.3e+30: tmp = t_1 elif y <= 1.42e-163: tmp = x * math.exp((a * -b)) elif (y <= 1e-5) or not (y <= 4.6e+153): tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * (z ^ y)) t_2 = Float64(x * exp(Float64(y * Float64(-t)))) tmp = 0.0 if (y <= -5.4e+192) tmp = t_2; elseif (y <= -4.3e+30) tmp = t_1; elseif (y <= 1.42e-163) tmp = Float64(x * exp(Float64(a * Float64(-b)))); elseif ((y <= 1e-5) || !(y <= 4.6e+153)) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * (z ^ y); t_2 = x * exp((y * -t)); tmp = 0.0; if (y <= -5.4e+192) tmp = t_2; elseif (y <= -4.3e+30) tmp = t_1; elseif (y <= 1.42e-163) tmp = x * exp((a * -b)); elseif ((y <= 1e-5) || ~((y <= 4.6e+153))) tmp = t_2; 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]}, Block[{t$95$2 = N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.4e+192], t$95$2, If[LessEqual[y, -4.3e+30], t$95$1, If[LessEqual[y, 1.42e-163], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1e-5], N[Not[LessEqual[y, 4.6e+153]], $MachinePrecision]], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot {z}^{y}\\
t_2 := x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{if}\;y \leq -5.4 \cdot 10^{+192}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -4.3 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.42 \cdot 10^{-163}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\mathbf{elif}\;y \leq 10^{-5} \lor \neg \left(y \leq 4.6 \cdot 10^{+153}\right):\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.39999999999999979e192 or 1.4200000000000001e-163 < y < 1.00000000000000008e-5 or 4.6000000000000003e153 < y Initial program 95.5%
Taylor expanded in z around 0 100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-lft-out100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in t around inf 77.7%
mul-1-neg77.7%
Simplified77.7%
if -5.39999999999999979e192 < y < -4.3e30 or 1.00000000000000008e-5 < y < 4.6000000000000003e153Initial program 98.2%
Taylor expanded in a around 0 90.6%
*-commutative90.6%
exp-prod90.6%
exp-diff90.6%
rem-exp-log90.6%
Simplified90.6%
Taylor expanded in t around 0 79.3%
if -4.3e30 < y < 1.4200000000000001e-163Initial program 95.7%
Taylor expanded in z around 0 99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-lft-out99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 98.2%
mul-1-neg98.2%
distribute-lft-neg-out98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in b around inf 82.6%
associate-*r*82.6%
mul-1-neg82.6%
Simplified82.6%
Final simplification80.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (pow (- z (* z t)) y))) (t_2 (* x (exp (* y (- t))))))
(if (<= y -7.2e+181)
t_2
(if (<= y -1.55e+23)
t_1
(if (<= y 1.42e-163)
(* x (exp (* a (- b))))
(if (<= y 1.65e+63) t_2 t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * pow((z - (z * t)), y);
double t_2 = x * exp((y * -t));
double tmp;
if (y <= -7.2e+181) {
tmp = t_2;
} else if (y <= -1.55e+23) {
tmp = t_1;
} else if (y <= 1.42e-163) {
tmp = x * exp((a * -b));
} else if (y <= 1.65e+63) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = x * ((z - (z * t)) ** y)
t_2 = x * exp((y * -t))
if (y <= (-7.2d+181)) then
tmp = t_2
else if (y <= (-1.55d+23)) then
tmp = t_1
else if (y <= 1.42d-163) then
tmp = x * exp((a * -b))
else if (y <= 1.65d+63) then
tmp = t_2
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 - (z * t)), y);
double t_2 = x * Math.exp((y * -t));
double tmp;
if (y <= -7.2e+181) {
tmp = t_2;
} else if (y <= -1.55e+23) {
tmp = t_1;
} else if (y <= 1.42e-163) {
tmp = x * Math.exp((a * -b));
} else if (y <= 1.65e+63) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.pow((z - (z * t)), y) t_2 = x * math.exp((y * -t)) tmp = 0 if y <= -7.2e+181: tmp = t_2 elif y <= -1.55e+23: tmp = t_1 elif y <= 1.42e-163: tmp = x * math.exp((a * -b)) elif y <= 1.65e+63: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * (Float64(z - Float64(z * t)) ^ y)) t_2 = Float64(x * exp(Float64(y * Float64(-t)))) tmp = 0.0 if (y <= -7.2e+181) tmp = t_2; elseif (y <= -1.55e+23) tmp = t_1; elseif (y <= 1.42e-163) tmp = Float64(x * exp(Float64(a * Float64(-b)))); elseif (y <= 1.65e+63) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * ((z - (z * t)) ^ y); t_2 = x * exp((y * -t)); tmp = 0.0; if (y <= -7.2e+181) tmp = t_2; elseif (y <= -1.55e+23) tmp = t_1; elseif (y <= 1.42e-163) tmp = x * exp((a * -b)); elseif (y <= 1.65e+63) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Power[N[(z - N[(z * t), $MachinePrecision]), $MachinePrecision], y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.2e+181], t$95$2, If[LessEqual[y, -1.55e+23], t$95$1, If[LessEqual[y, 1.42e-163], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.65e+63], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot {\left(z - z \cdot t\right)}^{y}\\
t_2 := x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{if}\;y \leq -7.2 \cdot 10^{+181}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -1.55 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.42 \cdot 10^{-163}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+63}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.1999999999999997e181 or 1.4200000000000001e-163 < y < 1.6500000000000001e63Initial program 94.5%
Taylor expanded in z around 0 100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-lft-out100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in t around inf 79.3%
mul-1-neg79.3%
Simplified79.3%
if -7.1999999999999997e181 < y < -1.54999999999999985e23 or 1.6500000000000001e63 < y Initial program 98.7%
Taylor expanded in a around 0 90.7%
*-commutative90.7%
exp-prod90.7%
exp-diff90.7%
rem-exp-log90.7%
Simplified90.7%
Taylor expanded in t around 0 80.0%
associate-*r*80.0%
neg-mul-180.0%
Simplified80.0%
if -1.54999999999999985e23 < y < 1.4200000000000001e-163Initial program 95.5%
Taylor expanded in z around 0 99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-lft-out99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 98.2%
mul-1-neg98.2%
distribute-lft-neg-out98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in b around inf 83.5%
associate-*r*83.5%
mul-1-neg83.5%
Simplified83.5%
Final simplification81.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -6.1e+181) (and (not (<= y -4.4e+30)) (<= y 1.5e+66))) (* x (exp (- (* a (- (- b) z)) (* y t)))) (* x (pow (- z (* z t)) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -6.1e+181) || (!(y <= -4.4e+30) && (y <= 1.5e+66))) {
tmp = x * exp(((a * (-b - z)) - (y * t)));
} else {
tmp = x * pow((z - (z * t)), 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 ((y <= (-6.1d+181)) .or. (.not. (y <= (-4.4d+30))) .and. (y <= 1.5d+66)) then
tmp = x * exp(((a * (-b - z)) - (y * t)))
else
tmp = x * ((z - (z * t)) ** 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 ((y <= -6.1e+181) || (!(y <= -4.4e+30) && (y <= 1.5e+66))) {
tmp = x * Math.exp(((a * (-b - z)) - (y * t)));
} else {
tmp = x * Math.pow((z - (z * t)), y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -6.1e+181) or (not (y <= -4.4e+30) and (y <= 1.5e+66)): tmp = x * math.exp(((a * (-b - z)) - (y * t))) else: tmp = x * math.pow((z - (z * t)), y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -6.1e+181) || (!(y <= -4.4e+30) && (y <= 1.5e+66))) tmp = Float64(x * exp(Float64(Float64(a * Float64(Float64(-b) - z)) - Float64(y * t)))); else tmp = Float64(x * (Float64(z - Float64(z * t)) ^ y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -6.1e+181) || (~((y <= -4.4e+30)) && (y <= 1.5e+66))) tmp = x * exp(((a * (-b - z)) - (y * t))); else tmp = x * ((z - (z * t)) ^ y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -6.1e+181], And[N[Not[LessEqual[y, -4.4e+30]], $MachinePrecision], LessEqual[y, 1.5e+66]]], N[(x * N[Exp[N[(N[(a * N[((-b) - z), $MachinePrecision]), $MachinePrecision] - N[(y * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[N[(z - N[(z * t), $MachinePrecision]), $MachinePrecision], y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.1 \cdot 10^{+181} \lor \neg \left(y \leq -4.4 \cdot 10^{+30}\right) \land y \leq 1.5 \cdot 10^{+66}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-b\right) - z\right) - y \cdot t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {\left(z - z \cdot t\right)}^{y}\\
\end{array}
\end{array}
if y < -6.10000000000000001e181 or -4.4e30 < y < 1.50000000000000001e66Initial program 95.2%
Taylor expanded in z around 0 99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-lft-out99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 96.8%
mul-1-neg96.8%
distribute-lft-neg-out96.8%
*-commutative96.8%
Simplified96.8%
if -6.10000000000000001e181 < y < -4.4e30 or 1.50000000000000001e66 < y Initial program 98.6%
Taylor expanded in a around 0 90.0%
*-commutative90.0%
exp-prod90.0%
exp-diff90.0%
rem-exp-log90.0%
Simplified90.0%
Taylor expanded in t around 0 80.0%
associate-*r*80.0%
neg-mul-180.0%
Simplified80.0%
Final simplification92.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2600000000.0) (not (<= t 5e-36))) (* 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 <= -2600000000.0) || !(t <= 5e-36)) {
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 <= (-2600000000.0d0)) .or. (.not. (t <= 5d-36))) 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 <= -2600000000.0) || !(t <= 5e-36)) {
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 <= -2600000000.0) or not (t <= 5e-36): 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 <= -2600000000.0) || !(t <= 5e-36)) 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 <= -2600000000.0) || ~((t <= 5e-36))) 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, -2600000000.0], N[Not[LessEqual[t, 5e-36]], $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 -2600000000 \lor \neg \left(t \leq 5 \cdot 10^{-36}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\end{array}
if t < -2.6e9 or 5.00000000000000004e-36 < t Initial program 96.9%
Taylor expanded in z around 0 99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-lft-out99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 78.5%
mul-1-neg78.5%
Simplified78.5%
if -2.6e9 < t < 5.00000000000000004e-36Initial program 95.3%
Taylor expanded in a around 0 64.3%
*-commutative64.3%
exp-prod62.7%
exp-diff62.7%
rem-exp-log62.7%
Simplified62.7%
Taylor expanded in t around 0 64.3%
Final simplification71.7%
(FPCore (x y z t a b) :precision binary64 (* x (pow z y)))
double code(double x, double y, double z, double t, double a, double b) {
return x * pow(z, y);
}
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 * (z ** y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.pow(z, y);
}
def code(x, y, z, t, a, b): return x * math.pow(z, y)
function code(x, y, z, t, a, b) return Float64(x * (z ^ y)) end
function tmp = code(x, y, z, t, a, b) tmp = x * (z ^ y); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot {z}^{y}
\end{array}
Initial program 96.1%
Taylor expanded in a around 0 71.7%
*-commutative71.7%
exp-prod65.7%
exp-diff65.7%
rem-exp-log65.7%
Simplified65.7%
Taylor expanded in t around 0 49.8%
Final simplification49.8%
(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.1%
Taylor expanded in y around 0 59.6%
*-commutative59.6%
exp-prod52.1%
exp-diff52.1%
rem-exp-log52.1%
Simplified52.1%
Taylor expanded in a around 0 22.3%
Final simplification22.3%
herbie shell --seed 2024082
(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))))))