
(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 13 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 95.7%
fma-define96.2%
sub-neg96.2%
log1p-define98.8%
Simplified98.8%
(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 95.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.2e+27) (not (<= y 7.8e-11))) (* x (pow (/ z (exp t)) y)) (* x (exp (* a (- (log1p (- z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.2e+27) || !(y <= 7.8e-11)) {
tmp = x * pow((z / exp(t)), y);
} 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 <= -1.2e+27) || !(y <= 7.8e-11)) {
tmp = x * Math.pow((z / Math.exp(t)), y);
} else {
tmp = x * Math.exp((a * (Math.log1p(-z) - b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.2e+27) or not (y <= 7.8e-11): tmp = x * math.pow((z / math.exp(t)), y) 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 <= -1.2e+27) || !(y <= 7.8e-11)) tmp = Float64(x * (Float64(z / exp(t)) ^ y)); 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, -1.2e+27], N[Not[LessEqual[y, 7.8e-11]], $MachinePrecision]], N[(x * N[Power[N[(z / N[Exp[t], $MachinePrecision]), $MachinePrecision], y], $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 -1.2 \cdot 10^{+27} \lor \neg \left(y \leq 7.8 \cdot 10^{-11}\right):\\
\;\;\;\;x \cdot {\left(\frac{z}{e^{t}}\right)}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}\\
\end{array}
\end{array}
if y < -1.19999999999999999e27 or 7.80000000000000021e-11 < y Initial program 95.7%
Taylor expanded in a around 0 89.4%
*-commutative89.4%
exp-prod89.4%
exp-diff89.4%
rem-exp-log89.4%
Simplified89.4%
if -1.19999999999999999e27 < y < 7.80000000000000021e-11Initial program 95.8%
Taylor expanded in y around 0 81.6%
sub-neg81.6%
log1p-define85.8%
Simplified85.8%
Final simplification87.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -8.5e-25) (not (<= y 2.5e-11))) (* x (pow (/ z (exp t)) y)) (* x (exp (* a (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -8.5e-25) || !(y <= 2.5e-11)) {
tmp = x * pow((z / exp(t)), 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 <= (-8.5d-25)) .or. (.not. (y <= 2.5d-11))) then
tmp = x * ((z / exp(t)) ** 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 <= -8.5e-25) || !(y <= 2.5e-11)) {
tmp = x * Math.pow((z / Math.exp(t)), y);
} else {
tmp = x * Math.exp((a * -b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -8.5e-25) or not (y <= 2.5e-11): tmp = x * math.pow((z / math.exp(t)), y) else: tmp = x * math.exp((a * -b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -8.5e-25) || !(y <= 2.5e-11)) tmp = Float64(x * (Float64(z / exp(t)) ^ 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 <= -8.5e-25) || ~((y <= 2.5e-11))) tmp = x * ((z / exp(t)) ^ y); else tmp = x * exp((a * -b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -8.5e-25], N[Not[LessEqual[y, 2.5e-11]], $MachinePrecision]], N[(x * N[Power[N[(z / N[Exp[t], $MachinePrecision]), $MachinePrecision], y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-25} \lor \neg \left(y \leq 2.5 \cdot 10^{-11}\right):\\
\;\;\;\;x \cdot {\left(\frac{z}{e^{t}}\right)}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\end{array}
\end{array}
if y < -8.49999999999999981e-25 or 2.50000000000000009e-11 < y Initial program 95.3%
Taylor expanded in a around 0 88.0%
*-commutative88.0%
exp-prod88.0%
exp-diff88.0%
rem-exp-log88.0%
Simplified88.0%
if -8.49999999999999981e-25 < y < 2.50000000000000009e-11Initial program 96.4%
Taylor expanded in b around inf 83.0%
associate-*r*83.0%
mul-1-neg83.0%
Simplified83.0%
Final simplification85.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= y -5.8e+229)
(* x (exp (* t (- y))))
(if (or (<= y -2.8e+15) (not (<= y 1.9e-10)))
(* 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 <= -5.8e+229) {
tmp = x * exp((t * -y));
} else if ((y <= -2.8e+15) || !(y <= 1.9e-10)) {
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 <= (-5.8d+229)) then
tmp = x * exp((t * -y))
else if ((y <= (-2.8d+15)) .or. (.not. (y <= 1.9d-10))) 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 <= -5.8e+229) {
tmp = x * Math.exp((t * -y));
} else if ((y <= -2.8e+15) || !(y <= 1.9e-10)) {
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 <= -5.8e+229: tmp = x * math.exp((t * -y)) elif (y <= -2.8e+15) or not (y <= 1.9e-10): 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 <= -5.8e+229) tmp = Float64(x * exp(Float64(t * Float64(-y)))); elseif ((y <= -2.8e+15) || !(y <= 1.9e-10)) 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 <= -5.8e+229) tmp = x * exp((t * -y)); elseif ((y <= -2.8e+15) || ~((y <= 1.9e-10))) tmp = x * (z ^ y); else tmp = x * exp((a * -b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -5.8e+229], N[(x * N[Exp[N[(t * (-y)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -2.8e+15], N[Not[LessEqual[y, 1.9e-10]], $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 -5.8 \cdot 10^{+229}:\\
\;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\
\mathbf{elif}\;y \leq -2.8 \cdot 10^{+15} \lor \neg \left(y \leq 1.9 \cdot 10^{-10}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\end{array}
\end{array}
if y < -5.79999999999999963e229Initial program 93.3%
Taylor expanded in t around inf 86.9%
mul-1-neg86.9%
distribute-lft-neg-out86.9%
*-commutative86.9%
Simplified86.9%
if -5.79999999999999963e229 < y < -2.8e15 or 1.8999999999999999e-10 < y Initial program 95.3%
Taylor expanded in a around 0 86.9%
*-commutative86.9%
exp-prod86.9%
exp-diff86.9%
rem-exp-log86.9%
Simplified86.9%
Taylor expanded in t around 0 71.6%
if -2.8e15 < y < 1.8999999999999999e-10Initial program 96.5%
Taylor expanded in b around inf 81.9%
associate-*r*81.9%
mul-1-neg81.9%
Simplified81.9%
Final simplification77.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -560.0) (not (<= t 5e-22))) (* x (exp (* t (- y)))) (* x (pow z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -560.0) || !(t <= 5e-22)) {
tmp = x * exp((t * -y));
} 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 <= (-560.0d0)) .or. (.not. (t <= 5d-22))) then
tmp = x * exp((t * -y))
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 <= -560.0) || !(t <= 5e-22)) {
tmp = x * Math.exp((t * -y));
} else {
tmp = x * Math.pow(z, y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -560.0) or not (t <= 5e-22): tmp = x * math.exp((t * -y)) else: tmp = x * math.pow(z, y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -560.0) || !(t <= 5e-22)) tmp = Float64(x * exp(Float64(t * Float64(-y)))); 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 <= -560.0) || ~((t <= 5e-22))) tmp = x * exp((t * -y)); else tmp = x * (z ^ y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -560.0], N[Not[LessEqual[t, 5e-22]], $MachinePrecision]], N[(x * N[Exp[N[(t * (-y)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -560 \lor \neg \left(t \leq 5 \cdot 10^{-22}\right):\\
\;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\end{array}
if t < -560 or 4.99999999999999954e-22 < t Initial program 95.0%
Taylor expanded in t around inf 81.8%
mul-1-neg81.8%
distribute-lft-neg-out81.8%
*-commutative81.8%
Simplified81.8%
if -560 < t < 4.99999999999999954e-22Initial program 96.6%
Taylor expanded in a around 0 67.8%
*-commutative67.8%
exp-prod67.8%
exp-diff67.8%
rem-exp-log67.8%
Simplified67.8%
Taylor expanded in t around 0 67.8%
Final simplification75.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -7.8e+15) (not (<= y 7.8e-11))) (* 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 <= -7.8e+15) || !(y <= 7.8e-11)) {
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 <= (-7.8d+15)) .or. (.not. (y <= 7.8d-11))) 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 <= -7.8e+15) || !(y <= 7.8e-11)) {
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 <= -7.8e+15) or not (y <= 7.8e-11): 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 <= -7.8e+15) || !(y <= 7.8e-11)) 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 <= -7.8e+15) || ~((y <= 7.8e-11))) 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, -7.8e+15], N[Not[LessEqual[y, 7.8e-11]], $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 -7.8 \cdot 10^{+15} \lor \neg \left(y \leq 7.8 \cdot 10^{-11}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\end{array}
\end{array}
if y < -7.8e15 or 7.80000000000000021e-11 < y Initial program 95.8%
Taylor expanded in a around 0 88.9%
*-commutative88.9%
exp-prod88.9%
exp-diff88.9%
rem-exp-log88.9%
Simplified88.9%
Taylor expanded in t around 0 69.5%
if -7.8e15 < y < 7.80000000000000021e-11Initial program 95.7%
Taylor expanded in b around inf 81.2%
associate-*r*81.2%
mul-1-neg81.2%
Simplified81.2%
Taylor expanded in a around 0 51.4%
mul-1-neg51.4%
unsub-neg51.4%
Simplified51.4%
Final simplification61.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (* a (- b)))))
(if (<= y -1.55e+22)
t_1
(if (<= y -8.2e-68)
(* a (/ x a))
(if (or (<= y -7.8e-130) (not (<= y 2.5e-55))) t_1 x)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * (a * -b);
double tmp;
if (y <= -1.55e+22) {
tmp = t_1;
} else if (y <= -8.2e-68) {
tmp = a * (x / a);
} else if ((y <= -7.8e-130) || !(y <= 2.5e-55)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (a * -b)
if (y <= (-1.55d+22)) then
tmp = t_1
else if (y <= (-8.2d-68)) then
tmp = a * (x / a)
else if ((y <= (-7.8d-130)) .or. (.not. (y <= 2.5d-55))) then
tmp = t_1
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 t_1 = x * (a * -b);
double tmp;
if (y <= -1.55e+22) {
tmp = t_1;
} else if (y <= -8.2e-68) {
tmp = a * (x / a);
} else if ((y <= -7.8e-130) || !(y <= 2.5e-55)) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * (a * -b) tmp = 0 if y <= -1.55e+22: tmp = t_1 elif y <= -8.2e-68: tmp = a * (x / a) elif (y <= -7.8e-130) or not (y <= 2.5e-55): tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * Float64(a * Float64(-b))) tmp = 0.0 if (y <= -1.55e+22) tmp = t_1; elseif (y <= -8.2e-68) tmp = Float64(a * Float64(x / a)); elseif ((y <= -7.8e-130) || !(y <= 2.5e-55)) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * (a * -b); tmp = 0.0; if (y <= -1.55e+22) tmp = t_1; elseif (y <= -8.2e-68) tmp = a * (x / a); elseif ((y <= -7.8e-130) || ~((y <= 2.5e-55))) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[(a * (-b)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.55e+22], t$95$1, If[LessEqual[y, -8.2e-68], N[(a * N[(x / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -7.8e-130], N[Not[LessEqual[y, 2.5e-55]], $MachinePrecision]], t$95$1, x]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(a \cdot \left(-b\right)\right)\\
\mathbf{if}\;y \leq -1.55 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -8.2 \cdot 10^{-68}:\\
\;\;\;\;a \cdot \frac{x}{a}\\
\mathbf{elif}\;y \leq -7.8 \cdot 10^{-130} \lor \neg \left(y \leq 2.5 \cdot 10^{-55}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.5500000000000001e22 or -8.20000000000000042e-68 < y < -7.8000000000000002e-130 or 2.5000000000000001e-55 < y Initial program 96.2%
Taylor expanded in b around inf 42.7%
associate-*r*42.7%
mul-1-neg42.7%
Simplified42.7%
Taylor expanded in a around 0 14.7%
mul-1-neg14.7%
unsub-neg14.7%
Simplified14.7%
Taylor expanded in a around inf 21.5%
associate-*r*25.4%
associate-*r*25.4%
*-commutative25.4%
associate-*r*25.4%
mul-1-neg25.4%
Simplified25.4%
if -1.5500000000000001e22 < y < -8.20000000000000042e-68Initial program 93.4%
Taylor expanded in b around inf 67.4%
associate-*r*67.4%
mul-1-neg67.4%
Simplified67.4%
Taylor expanded in a around 0 34.9%
mul-1-neg34.9%
unsub-neg34.9%
Simplified34.9%
Taylor expanded in a around inf 34.8%
+-commutative34.8%
mul-1-neg34.8%
sub-neg34.8%
*-commutative34.8%
Simplified34.8%
Taylor expanded in a around 0 48.2%
if -7.8000000000000002e-130 < y < 2.5000000000000001e-55Initial program 95.4%
Taylor expanded in b around inf 82.7%
associate-*r*82.7%
mul-1-neg82.7%
Simplified82.7%
Taylor expanded in a around 0 46.1%
Final simplification33.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (* a (- b)))))
(if (<= y -1.5e+22)
t_1
(if (<= y -1.06e-63)
(* a (/ x a))
(if (<= y 0.00038) (* x (- 1.0 (* a b))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * (a * -b);
double tmp;
if (y <= -1.5e+22) {
tmp = t_1;
} else if (y <= -1.06e-63) {
tmp = a * (x / a);
} else if (y <= 0.00038) {
tmp = x * (1.0 - (a * b));
} 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 * (a * -b)
if (y <= (-1.5d+22)) then
tmp = t_1
else if (y <= (-1.06d-63)) then
tmp = a * (x / a)
else if (y <= 0.00038d0) then
tmp = x * (1.0d0 - (a * b))
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 * (a * -b);
double tmp;
if (y <= -1.5e+22) {
tmp = t_1;
} else if (y <= -1.06e-63) {
tmp = a * (x / a);
} else if (y <= 0.00038) {
tmp = x * (1.0 - (a * b));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * (a * -b) tmp = 0 if y <= -1.5e+22: tmp = t_1 elif y <= -1.06e-63: tmp = a * (x / a) elif y <= 0.00038: tmp = x * (1.0 - (a * b)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * Float64(a * Float64(-b))) tmp = 0.0 if (y <= -1.5e+22) tmp = t_1; elseif (y <= -1.06e-63) tmp = Float64(a * Float64(x / a)); elseif (y <= 0.00038) tmp = Float64(x * Float64(1.0 - Float64(a * b))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * (a * -b); tmp = 0.0; if (y <= -1.5e+22) tmp = t_1; elseif (y <= -1.06e-63) tmp = a * (x / a); elseif (y <= 0.00038) tmp = x * (1.0 - (a * b)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[(a * (-b)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.5e+22], t$95$1, If[LessEqual[y, -1.06e-63], N[(a * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.00038], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(a \cdot \left(-b\right)\right)\\
\mathbf{if}\;y \leq -1.5 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.06 \cdot 10^{-63}:\\
\;\;\;\;a \cdot \frac{x}{a}\\
\mathbf{elif}\;y \leq 0.00038:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.5e22 or 3.8000000000000002e-4 < y Initial program 95.7%
Taylor expanded in b around inf 39.0%
associate-*r*39.0%
mul-1-neg39.0%
Simplified39.0%
Taylor expanded in a around 0 11.5%
mul-1-neg11.5%
unsub-neg11.5%
Simplified11.5%
Taylor expanded in a around inf 19.6%
associate-*r*23.3%
associate-*r*23.3%
*-commutative23.3%
associate-*r*23.3%
mul-1-neg23.3%
Simplified23.3%
if -1.5e22 < y < -1.06000000000000004e-63Initial program 93.0%
Taylor expanded in b around inf 65.1%
associate-*r*65.1%
mul-1-neg65.1%
Simplified65.1%
Taylor expanded in a around 0 30.2%
mul-1-neg30.2%
unsub-neg30.2%
Simplified30.2%
Taylor expanded in a around inf 30.1%
+-commutative30.1%
mul-1-neg30.1%
sub-neg30.1%
*-commutative30.1%
Simplified30.1%
Taylor expanded in a around 0 44.5%
if -1.06000000000000004e-63 < y < 3.8000000000000002e-4Initial program 96.2%
Taylor expanded in b around inf 80.9%
associate-*r*80.9%
mul-1-neg80.9%
Simplified80.9%
Taylor expanded in a around 0 53.0%
mul-1-neg53.0%
unsub-neg53.0%
Simplified53.0%
Final simplification36.5%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.3e+27) (* a (* b (- (/ x (* a b)) x))) (if (<= y 0.0136) (* x (- 1.0 (* a b))) (* x (* a (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.3e+27) {
tmp = a * (b * ((x / (a * b)) - x));
} else if (y <= 0.0136) {
tmp = x * (1.0 - (a * b));
} else {
tmp = x * (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.3d+27)) then
tmp = a * (b * ((x / (a * b)) - x))
else if (y <= 0.0136d0) then
tmp = x * (1.0d0 - (a * b))
else
tmp = x * (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.3e+27) {
tmp = a * (b * ((x / (a * b)) - x));
} else if (y <= 0.0136) {
tmp = x * (1.0 - (a * b));
} else {
tmp = x * (a * -b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.3e+27: tmp = a * (b * ((x / (a * b)) - x)) elif y <= 0.0136: tmp = x * (1.0 - (a * b)) else: tmp = x * (a * -b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.3e+27) tmp = Float64(a * Float64(b * Float64(Float64(x / Float64(a * b)) - x))); elseif (y <= 0.0136) tmp = Float64(x * Float64(1.0 - Float64(a * b))); else tmp = Float64(x * Float64(a * Float64(-b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1.3e+27) tmp = a * (b * ((x / (a * b)) - x)); elseif (y <= 0.0136) tmp = x * (1.0 - (a * b)); else tmp = x * (a * -b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.3e+27], N[(a * N[(b * N[(N[(x / N[(a * b), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.0136], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(a * (-b)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+27}:\\
\;\;\;\;a \cdot \left(b \cdot \left(\frac{x}{a \cdot b} - x\right)\right)\\
\mathbf{elif}\;y \leq 0.0136:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\
\end{array}
\end{array}
if y < -1.30000000000000004e27Initial program 95.4%
Taylor expanded in b around inf 34.3%
associate-*r*34.3%
mul-1-neg34.3%
Simplified34.3%
Taylor expanded in a around 0 10.5%
mul-1-neg10.5%
unsub-neg10.5%
Simplified10.5%
Taylor expanded in a around inf 11.9%
+-commutative11.9%
mul-1-neg11.9%
sub-neg11.9%
*-commutative11.9%
Simplified11.9%
Taylor expanded in b around inf 19.3%
if -1.30000000000000004e27 < y < 0.0135999999999999992Initial program 95.9%
Taylor expanded in b around inf 79.6%
associate-*r*79.6%
mul-1-neg79.6%
Simplified79.6%
Taylor expanded in a around 0 50.7%
mul-1-neg50.7%
unsub-neg50.7%
Simplified50.7%
if 0.0135999999999999992 < y Initial program 95.7%
Taylor expanded in b around inf 40.6%
associate-*r*40.6%
mul-1-neg40.6%
Simplified40.6%
Taylor expanded in a around 0 10.0%
mul-1-neg10.0%
unsub-neg10.0%
Simplified10.0%
Taylor expanded in a around inf 24.9%
associate-*r*29.7%
associate-*r*29.7%
*-commutative29.7%
associate-*r*29.7%
mul-1-neg29.7%
Simplified29.7%
Final simplification37.0%
(FPCore (x y z t a b) :precision binary64 (if (<= y -8.2e-249) (* a (/ x a)) (if (<= y 3.8e-46) x (* a (* x (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -8.2e-249) {
tmp = a * (x / a);
} else if (y <= 3.8e-46) {
tmp = x;
} else {
tmp = a * (x * -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 <= (-8.2d-249)) then
tmp = a * (x / a)
else if (y <= 3.8d-46) then
tmp = x
else
tmp = a * (x * -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 <= -8.2e-249) {
tmp = a * (x / a);
} else if (y <= 3.8e-46) {
tmp = x;
} else {
tmp = a * (x * -b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -8.2e-249: tmp = a * (x / a) elif y <= 3.8e-46: tmp = x else: tmp = a * (x * -b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -8.2e-249) tmp = Float64(a * Float64(x / a)); elseif (y <= 3.8e-46) tmp = x; else tmp = Float64(a * Float64(x * Float64(-b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -8.2e-249) tmp = a * (x / a); elseif (y <= 3.8e-46) tmp = x; else tmp = a * (x * -b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -8.2e-249], N[(a * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.8e-46], x, N[(a * N[(x * (-b)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{-249}:\\
\;\;\;\;a \cdot \frac{x}{a}\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-46}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\
\end{array}
\end{array}
if y < -8.20000000000000007e-249Initial program 94.7%
Taylor expanded in b around inf 51.0%
associate-*r*51.0%
mul-1-neg51.0%
Simplified51.0%
Taylor expanded in a around 0 25.7%
mul-1-neg25.7%
unsub-neg25.7%
Simplified25.7%
Taylor expanded in a around inf 24.8%
+-commutative24.8%
mul-1-neg24.8%
sub-neg24.8%
*-commutative24.8%
Simplified24.8%
Taylor expanded in a around 0 20.8%
if -8.20000000000000007e-249 < y < 3.7999999999999997e-46Initial program 96.9%
Taylor expanded in b around inf 86.4%
associate-*r*86.4%
mul-1-neg86.4%
Simplified86.4%
Taylor expanded in a around 0 50.2%
if 3.7999999999999997e-46 < y Initial program 96.3%
Taylor expanded in b around inf 42.8%
associate-*r*42.8%
mul-1-neg42.8%
Simplified42.8%
Taylor expanded in a around 0 12.4%
mul-1-neg12.4%
unsub-neg12.4%
Simplified12.4%
Taylor expanded in a around inf 25.9%
associate-*r*28.9%
associate-*r*28.9%
*-commutative28.9%
associate-*r*28.9%
mul-1-neg28.9%
Simplified28.9%
Taylor expanded in x around 0 25.9%
*-commutative25.9%
neg-mul-125.9%
distribute-rgt-neg-in25.9%
distribute-rgt-neg-out25.9%
Simplified25.9%
(FPCore (x y z t a b) :precision binary64 (* a (/ x a)))
double code(double x, double y, double z, double t, double a, double b) {
return a * (x / a);
}
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 = a * (x / a)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a * (x / a);
}
def code(x, y, z, t, a, b): return a * (x / a)
function code(x, y, z, t, a, b) return Float64(a * Float64(x / a)) end
function tmp = code(x, y, z, t, a, b) tmp = a * (x / a); end
code[x_, y_, z_, t_, a_, b_] := N[(a * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \frac{x}{a}
\end{array}
Initial program 95.7%
Taylor expanded in b around inf 57.4%
associate-*r*57.4%
mul-1-neg57.4%
Simplified57.4%
Taylor expanded in a around 0 29.4%
mul-1-neg29.4%
unsub-neg29.4%
Simplified29.4%
Taylor expanded in a around inf 24.8%
+-commutative24.8%
mul-1-neg24.8%
sub-neg24.8%
*-commutative24.8%
Simplified24.8%
Taylor expanded in a around 0 23.3%
(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 95.7%
Taylor expanded in b around inf 57.4%
associate-*r*57.4%
mul-1-neg57.4%
Simplified57.4%
Taylor expanded in a around 0 19.6%
herbie shell --seed 2024085
(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))))))