
(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 97.7%
fma-def97.7%
sub-neg97.7%
log1p-def99.6%
Simplified99.6%
Final simplification99.6%
(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 97.7%
Final simplification97.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.1e-34) (not (<= y 1.45e-13))) (* x (pow (/ z (exp t)) y)) (* x (exp (* a (- (- z) b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.1e-34) || !(y <= 1.45e-13)) {
tmp = x * pow((z / exp(t)), y);
} else {
tmp = x * exp((a * (-z - 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.1d-34)) .or. (.not. (y <= 1.45d-13))) then
tmp = x * ((z / exp(t)) ** y)
else
tmp = x * exp((a * (-z - 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.1e-34) || !(y <= 1.45e-13)) {
tmp = x * Math.pow((z / Math.exp(t)), y);
} else {
tmp = x * Math.exp((a * (-z - b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.1e-34) or not (y <= 1.45e-13): tmp = x * math.pow((z / math.exp(t)), y) else: tmp = x * math.exp((a * (-z - b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.1e-34) || !(y <= 1.45e-13)) tmp = Float64(x * (Float64(z / exp(t)) ^ y)); else tmp = Float64(x * exp(Float64(a * Float64(Float64(-z) - b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.1e-34) || ~((y <= 1.45e-13))) tmp = x * ((z / exp(t)) ^ y); else tmp = x * exp((a * (-z - b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.1e-34], N[Not[LessEqual[y, 1.45e-13]], $MachinePrecision]], N[(x * N[Power[N[(z / N[Exp[t], $MachinePrecision]), $MachinePrecision], y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * N[((-z) - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-34} \lor \neg \left(y \leq 1.45 \cdot 10^{-13}\right):\\
\;\;\;\;x \cdot {\left(\frac{z}{e^{t}}\right)}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\
\end{array}
\end{array}
if y < -1.0999999999999999e-34 or 1.4499999999999999e-13 < y Initial program 99.3%
fma-def99.3%
sub-neg99.3%
log1p-def99.3%
Simplified99.3%
Taylor expanded in a around 0 91.2%
*-commutative91.2%
exp-prod91.2%
exp-diff91.2%
rem-exp-log91.2%
Simplified91.2%
if -1.0999999999999999e-34 < y < 1.4499999999999999e-13Initial program 95.6%
Taylor expanded in y around 0 80.7%
sub-neg80.7%
sub-neg80.7%
neg-mul-180.7%
log1p-def85.1%
neg-mul-185.1%
sub-neg85.1%
Simplified85.1%
Taylor expanded in z around 0 85.1%
associate-*r*85.1%
associate-*r*85.1%
distribute-lft-out85.1%
mul-1-neg85.1%
Simplified85.1%
Final simplification88.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (pow z y))))
(if (<= y -0.00265)
t_1
(if (<= y 1.6e-31)
(* x (exp (* a (- b))))
(if (or (<= y 1.12) (and (not (<= y 1.95e+145)) (<= y 1.8e+210)))
(* x (exp (* y (- t))))
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.00265) {
tmp = t_1;
} else if (y <= 1.6e-31) {
tmp = x * exp((a * -b));
} else if ((y <= 1.12) || (!(y <= 1.95e+145) && (y <= 1.8e+210))) {
tmp = x * exp((y * -t));
} 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.00265d0)) then
tmp = t_1
else if (y <= 1.6d-31) then
tmp = x * exp((a * -b))
else if ((y <= 1.12d0) .or. (.not. (y <= 1.95d+145)) .and. (y <= 1.8d+210)) then
tmp = x * exp((y * -t))
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.00265) {
tmp = t_1;
} else if (y <= 1.6e-31) {
tmp = x * Math.exp((a * -b));
} else if ((y <= 1.12) || (!(y <= 1.95e+145) && (y <= 1.8e+210))) {
tmp = x * Math.exp((y * -t));
} 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.00265: tmp = t_1 elif y <= 1.6e-31: tmp = x * math.exp((a * -b)) elif (y <= 1.12) or (not (y <= 1.95e+145) and (y <= 1.8e+210)): tmp = x * math.exp((y * -t)) 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.00265) tmp = t_1; elseif (y <= 1.6e-31) tmp = Float64(x * exp(Float64(a * Float64(-b)))); elseif ((y <= 1.12) || (!(y <= 1.95e+145) && (y <= 1.8e+210))) tmp = Float64(x * exp(Float64(y * Float64(-t)))); 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.00265) tmp = t_1; elseif (y <= 1.6e-31) tmp = x * exp((a * -b)); elseif ((y <= 1.12) || (~((y <= 1.95e+145)) && (y <= 1.8e+210))) tmp = x * exp((y * -t)); 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.00265], t$95$1, If[LessEqual[y, 1.6e-31], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1.12], And[N[Not[LessEqual[y, 1.95e+145]], $MachinePrecision], LessEqual[y, 1.8e+210]]], N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot {z}^{y}\\
\mathbf{if}\;y \leq -0.00265:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-31}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\mathbf{elif}\;y \leq 1.12 \lor \neg \left(y \leq 1.95 \cdot 10^{+145}\right) \land y \leq 1.8 \cdot 10^{+210}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -0.00265000000000000001 or 1.1200000000000001 < y < 1.9499999999999999e145 or 1.8000000000000001e210 < y Initial program 99.2%
fma-def99.2%
sub-neg99.2%
log1p-def99.2%
Simplified99.2%
Taylor expanded in a around 0 91.9%
*-commutative91.9%
exp-prod91.9%
exp-diff91.9%
rem-exp-log91.9%
Simplified91.9%
Taylor expanded in t around 0 77.4%
if -0.00265000000000000001 < y < 1.60000000000000009e-31Initial program 98.1%
Taylor expanded in b around inf 83.4%
mul-1-neg83.4%
distribute-rgt-neg-out83.4%
Simplified83.4%
if 1.60000000000000009e-31 < y < 1.1200000000000001 or 1.9499999999999999e145 < y < 1.8000000000000001e210Initial program 89.8%
Taylor expanded in t around inf 73.6%
mul-1-neg73.6%
distribute-lft-neg-out73.6%
*-commutative73.6%
Simplified73.6%
Final simplification79.4%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= y -0.0011)
(and (not (<= y 0.003)) (or (<= y 4.3e+138) (not (<= y 1.65e+196)))))
(* 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 <= -0.0011) || (!(y <= 0.003) && ((y <= 4.3e+138) || !(y <= 1.65e+196)))) {
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 <= (-0.0011d0)) .or. (.not. (y <= 0.003d0)) .and. (y <= 4.3d+138) .or. (.not. (y <= 1.65d+196))) 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 <= -0.0011) || (!(y <= 0.003) && ((y <= 4.3e+138) || !(y <= 1.65e+196)))) {
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 <= -0.0011) or (not (y <= 0.003) and ((y <= 4.3e+138) or not (y <= 1.65e+196))): 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 <= -0.0011) || (!(y <= 0.003) && ((y <= 4.3e+138) || !(y <= 1.65e+196)))) 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 <= -0.0011) || (~((y <= 0.003)) && ((y <= 4.3e+138) || ~((y <= 1.65e+196))))) 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, -0.0011], And[N[Not[LessEqual[y, 0.003]], $MachinePrecision], Or[LessEqual[y, 4.3e+138], N[Not[LessEqual[y, 1.65e+196]], $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 -0.0011 \lor \neg \left(y \leq 0.003\right) \land \left(y \leq 4.3 \cdot 10^{+138} \lor \neg \left(y \leq 1.65 \cdot 10^{+196}\right)\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\end{array}
\end{array}
if y < -0.00110000000000000007 or 0.0030000000000000001 < y < 4.2999999999999998e138 or 1.6500000000000001e196 < y Initial program 99.2%
fma-def99.2%
sub-neg99.2%
log1p-def99.2%
Simplified99.2%
Taylor expanded in a around 0 92.9%
*-commutative92.9%
exp-prod92.9%
exp-diff92.9%
rem-exp-log92.9%
Simplified92.9%
Taylor expanded in t around 0 77.2%
if -0.00110000000000000007 < y < 0.0030000000000000001 or 4.2999999999999998e138 < y < 1.6500000000000001e196Initial program 96.3%
Taylor expanded in b around inf 77.7%
mul-1-neg77.7%
distribute-rgt-neg-out77.7%
Simplified77.7%
Final simplification77.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (pow z y))))
(if (<= y -0.0028)
t_1
(if (<= y 0.0029)
(* x (exp (* a (- (- z) b))))
(if (or (<= y 7.2e+144) (not (<= y 7.8e+210)))
t_1
(* x (exp (* y (- t)))))))))
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.0028) {
tmp = t_1;
} else if (y <= 0.0029) {
tmp = x * exp((a * (-z - b)));
} else if ((y <= 7.2e+144) || !(y <= 7.8e+210)) {
tmp = t_1;
} else {
tmp = x * exp((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) :: t_1
real(8) :: tmp
t_1 = x * (z ** y)
if (y <= (-0.0028d0)) then
tmp = t_1
else if (y <= 0.0029d0) then
tmp = x * exp((a * (-z - b)))
else if ((y <= 7.2d+144) .or. (.not. (y <= 7.8d+210))) then
tmp = t_1
else
tmp = x * exp((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 t_1 = x * Math.pow(z, y);
double tmp;
if (y <= -0.0028) {
tmp = t_1;
} else if (y <= 0.0029) {
tmp = x * Math.exp((a * (-z - b)));
} else if ((y <= 7.2e+144) || !(y <= 7.8e+210)) {
tmp = t_1;
} else {
tmp = x * Math.exp((y * -t));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.pow(z, y) tmp = 0 if y <= -0.0028: tmp = t_1 elif y <= 0.0029: tmp = x * math.exp((a * (-z - b))) elif (y <= 7.2e+144) or not (y <= 7.8e+210): tmp = t_1 else: tmp = x * math.exp((y * -t)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * (z ^ y)) tmp = 0.0 if (y <= -0.0028) tmp = t_1; elseif (y <= 0.0029) tmp = Float64(x * exp(Float64(a * Float64(Float64(-z) - b)))); elseif ((y <= 7.2e+144) || !(y <= 7.8e+210)) tmp = t_1; else tmp = Float64(x * exp(Float64(y * Float64(-t)))); 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.0028) tmp = t_1; elseif (y <= 0.0029) tmp = x * exp((a * (-z - b))); elseif ((y <= 7.2e+144) || ~((y <= 7.8e+210))) tmp = t_1; else tmp = x * exp((y * -t)); 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.0028], t$95$1, If[LessEqual[y, 0.0029], N[(x * N[Exp[N[(a * N[((-z) - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 7.2e+144], N[Not[LessEqual[y, 7.8e+210]], $MachinePrecision]], t$95$1, N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot {z}^{y}\\
\mathbf{if}\;y \leq -0.0028:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 0.0029:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+144} \lor \neg \left(y \leq 7.8 \cdot 10^{+210}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\end{array}
\end{array}
if y < -0.00279999999999999997 or 0.0029 < y < 7.1999999999999995e144 or 7.8e210 < y Initial program 99.2%
fma-def99.2%
sub-neg99.2%
log1p-def99.2%
Simplified99.2%
Taylor expanded in a around 0 92.0%
*-commutative92.0%
exp-prod92.1%
exp-diff92.1%
rem-exp-log92.1%
Simplified92.1%
Taylor expanded in t around 0 77.0%
if -0.00279999999999999997 < y < 0.0029Initial program 95.9%
Taylor expanded in y around 0 78.7%
sub-neg78.7%
sub-neg78.7%
neg-mul-178.7%
log1p-def82.0%
neg-mul-182.0%
sub-neg82.0%
Simplified82.0%
Taylor expanded in z around 0 82.0%
associate-*r*82.0%
associate-*r*82.0%
distribute-lft-out82.0%
mul-1-neg82.0%
Simplified82.0%
if 7.1999999999999995e144 < y < 7.8e210Initial program 100.0%
Taylor expanded in t around inf 78.0%
mul-1-neg78.0%
distribute-lft-neg-out78.0%
*-commutative78.0%
Simplified78.0%
Final simplification79.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -7.2e-11) (not (<= y 3.7e-26))) (* x (pow z y)) (- x (* x (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -7.2e-11) || !(y <= 3.7e-26)) {
tmp = x * pow(z, y);
} else {
tmp = x - (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 <= (-7.2d-11)) .or. (.not. (y <= 3.7d-26))) then
tmp = x * (z ** y)
else
tmp = x - (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 <= -7.2e-11) || !(y <= 3.7e-26)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x - (x * (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -7.2e-11) or not (y <= 3.7e-26): tmp = x * math.pow(z, y) else: tmp = x - (x * (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -7.2e-11) || !(y <= 3.7e-26)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x - Float64(x * Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -7.2e-11) || ~((y <= 3.7e-26))) tmp = x * (z ^ y); else tmp = x - (x * (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -7.2e-11], N[Not[LessEqual[y, 3.7e-26]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-11} \lor \neg \left(y \leq 3.7 \cdot 10^{-26}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if y < -7.19999999999999969e-11 or 3.6999999999999999e-26 < y Initial program 97.4%
fma-def97.4%
sub-neg97.4%
log1p-def99.3%
Simplified99.3%
Taylor expanded in a around 0 89.5%
*-commutative89.5%
exp-prod89.5%
exp-diff89.5%
rem-exp-log89.5%
Simplified89.5%
Taylor expanded in t around 0 69.2%
if -7.19999999999999969e-11 < y < 3.6999999999999999e-26Initial program 98.2%
Taylor expanded in b around inf 82.6%
mul-1-neg82.6%
distribute-rgt-neg-out82.6%
Simplified82.6%
Taylor expanded in a around 0 41.9%
mul-1-neg41.9%
unsub-neg41.9%
associate-*r*46.6%
*-commutative46.6%
Simplified46.6%
Final simplification59.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -2.2e+179) (not (<= b 2.95e-148))) (- x (* x (* a b))) (* x (- 1.0 (* y t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -2.2e+179) || !(b <= 2.95e-148)) {
tmp = x - (x * (a * b));
} else {
tmp = x * (1.0 - (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 ((b <= (-2.2d+179)) .or. (.not. (b <= 2.95d-148))) then
tmp = x - (x * (a * b))
else
tmp = x * (1.0d0 - (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 ((b <= -2.2e+179) || !(b <= 2.95e-148)) {
tmp = x - (x * (a * b));
} else {
tmp = x * (1.0 - (y * t));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -2.2e+179) or not (b <= 2.95e-148): tmp = x - (x * (a * b)) else: tmp = x * (1.0 - (y * t)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -2.2e+179) || !(b <= 2.95e-148)) tmp = Float64(x - Float64(x * Float64(a * b))); else tmp = Float64(x * Float64(1.0 - Float64(y * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -2.2e+179) || ~((b <= 2.95e-148))) tmp = x - (x * (a * b)); else tmp = x * (1.0 - (y * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -2.2e+179], N[Not[LessEqual[b, 2.95e-148]], $MachinePrecision]], N[(x - N[(x * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.2 \cdot 10^{+179} \lor \neg \left(b \leq 2.95 \cdot 10^{-148}\right):\\
\;\;\;\;x - x \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\
\end{array}
\end{array}
if b < -2.2e179 or 2.95000000000000008e-148 < b Initial program 99.2%
Taylor expanded in b around inf 70.5%
mul-1-neg70.5%
distribute-rgt-neg-out70.5%
Simplified70.5%
Taylor expanded in a around 0 31.7%
mul-1-neg31.7%
unsub-neg31.7%
associate-*r*35.1%
*-commutative35.1%
Simplified35.1%
if -2.2e179 < b < 2.95000000000000008e-148Initial program 96.5%
Taylor expanded in t around inf 67.2%
mul-1-neg67.2%
distribute-lft-neg-out67.2%
*-commutative67.2%
Simplified67.2%
Taylor expanded in y around 0 34.8%
associate-*r*34.8%
neg-mul-134.8%
cancel-sign-sub-inv34.8%
Simplified34.8%
Final simplification34.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.15e+19) (not (<= y 2.4e-124))) (* t (* x (- y))) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.15e+19) || !(y <= 2.4e-124)) {
tmp = t * (x * -y);
} 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 ((y <= (-1.15d+19)) .or. (.not. (y <= 2.4d-124))) then
tmp = t * (x * -y)
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 ((y <= -1.15e+19) || !(y <= 2.4e-124)) {
tmp = t * (x * -y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.15e+19) or not (y <= 2.4e-124): tmp = t * (x * -y) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.15e+19) || !(y <= 2.4e-124)) tmp = Float64(t * Float64(x * Float64(-y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.15e+19) || ~((y <= 2.4e-124))) tmp = t * (x * -y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.15e+19], N[Not[LessEqual[y, 2.4e-124]], $MachinePrecision]], N[(t * N[(x * (-y)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+19} \lor \neg \left(y \leq 2.4 \cdot 10^{-124}\right):\\
\;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.15e19 or 2.39999999999999992e-124 < y Initial program 97.1%
Taylor expanded in t around inf 56.9%
mul-1-neg56.9%
distribute-lft-neg-out56.9%
*-commutative56.9%
Simplified56.9%
Taylor expanded in y around 0 19.8%
associate-*r*19.8%
neg-mul-119.8%
cancel-sign-sub-inv19.8%
Simplified19.8%
Taylor expanded in t around inf 20.1%
mul-1-neg20.1%
distribute-rgt-neg-in20.1%
*-commutative20.1%
distribute-rgt-neg-in20.1%
Simplified20.1%
if -1.15e19 < y < 2.39999999999999992e-124Initial program 98.8%
Taylor expanded in b around inf 88.2%
mul-1-neg88.2%
distribute-rgt-neg-out88.2%
Simplified88.2%
Taylor expanded in a around 0 41.6%
Final simplification27.0%
(FPCore (x y z t a b) :precision binary64 (if (<= y -8.5e+19) (* t (* x (- y))) (if (<= y 9e-107) x (* y (* x (- t))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -8.5e+19) {
tmp = t * (x * -y);
} else if (y <= 9e-107) {
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 (y <= (-8.5d+19)) then
tmp = t * (x * -y)
else if (y <= 9d-107) 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 (y <= -8.5e+19) {
tmp = t * (x * -y);
} else if (y <= 9e-107) {
tmp = x;
} else {
tmp = y * (x * -t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -8.5e+19: tmp = t * (x * -y) elif y <= 9e-107: tmp = x else: tmp = y * (x * -t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -8.5e+19) tmp = Float64(t * Float64(x * Float64(-y))); elseif (y <= 9e-107) tmp = x; else tmp = Float64(y * Float64(x * Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -8.5e+19) tmp = t * (x * -y); elseif (y <= 9e-107) tmp = x; else tmp = y * (x * -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -8.5e+19], N[(t * N[(x * (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e-107], x, N[(y * N[(x * (-t)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+19}:\\
\;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-107}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \left(-t\right)\right)\\
\end{array}
\end{array}
if y < -8.5e19Initial program 100.0%
Taylor expanded in t around inf 60.2%
mul-1-neg60.2%
distribute-lft-neg-out60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in y around 0 27.6%
associate-*r*27.6%
neg-mul-127.6%
cancel-sign-sub-inv27.6%
Simplified27.6%
Taylor expanded in t around inf 24.3%
mul-1-neg24.3%
distribute-rgt-neg-in24.3%
*-commutative24.3%
distribute-rgt-neg-in24.3%
Simplified24.3%
if -8.5e19 < y < 9.00000000000000032e-107Initial program 98.9%
Taylor expanded in b around inf 85.9%
mul-1-neg85.9%
distribute-rgt-neg-out85.9%
Simplified85.9%
Taylor expanded in a around 0 39.7%
if 9.00000000000000032e-107 < y Initial program 95.1%
Taylor expanded in t around inf 52.7%
mul-1-neg52.7%
distribute-lft-neg-out52.7%
*-commutative52.7%
Simplified52.7%
Taylor expanded in y around 0 14.8%
associate-*r*14.8%
neg-mul-114.8%
cancel-sign-sub-inv14.8%
Simplified14.8%
Taylor expanded in t around inf 16.6%
*-commutative16.6%
*-commutative16.6%
associate-*r*19.4%
neg-mul-119.4%
distribute-rgt-neg-in19.4%
distribute-rgt-neg-in19.4%
Simplified19.4%
Final simplification27.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.15e+86) (not (<= y 6e-119))) (* t (* x y)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.15e+86) || !(y <= 6e-119)) {
tmp = t * (x * y);
} 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 ((y <= (-1.15d+86)) .or. (.not. (y <= 6d-119))) then
tmp = t * (x * y)
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 ((y <= -1.15e+86) || !(y <= 6e-119)) {
tmp = t * (x * y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.15e+86) or not (y <= 6e-119): tmp = t * (x * y) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.15e+86) || !(y <= 6e-119)) tmp = Float64(t * Float64(x * y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.15e+86) || ~((y <= 6e-119))) tmp = t * (x * y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.15e+86], N[Not[LessEqual[y, 6e-119]], $MachinePrecision]], N[(t * N[(x * y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+86} \lor \neg \left(y \leq 6 \cdot 10^{-119}\right):\\
\;\;\;\;t \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.14999999999999995e86 or 6.0000000000000004e-119 < y Initial program 96.8%
Taylor expanded in t around inf 54.7%
mul-1-neg54.7%
distribute-lft-neg-out54.7%
*-commutative54.7%
Simplified54.7%
Taylor expanded in y around 0 17.2%
mul-1-neg17.2%
unsub-neg17.2%
*-commutative17.2%
associate-*l*19.7%
*-commutative19.7%
Simplified19.7%
sub-neg19.7%
associate-*r*16.1%
*-commutative16.1%
add-sqr-sqrt9.3%
sqrt-unprod16.2%
*-commutative16.2%
associate-*r*16.2%
*-commutative16.2%
associate-*r*16.2%
sqr-neg16.2%
sqrt-unprod5.7%
add-sqr-sqrt9.2%
*-commutative9.2%
distribute-rgt1-in9.2%
+-commutative9.2%
Applied egg-rr9.2%
Taylor expanded in t around inf 14.5%
if -1.14999999999999995e86 < y < 6.0000000000000004e-119Initial program 99.0%
Taylor expanded in b around inf 80.5%
mul-1-neg80.5%
distribute-rgt-neg-out80.5%
Simplified80.5%
Taylor expanded in a around 0 35.2%
Final simplification22.6%
(FPCore (x y z t a b) :precision binary64 (if (<= y 0.031) (* x (- 1.0 (* y t))) (* y (* x (- t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= 0.031) {
tmp = x * (1.0 - (y * t));
} 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 (y <= 0.031d0) then
tmp = x * (1.0d0 - (y * t))
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 (y <= 0.031) {
tmp = x * (1.0 - (y * t));
} else {
tmp = y * (x * -t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= 0.031: tmp = x * (1.0 - (y * t)) else: tmp = y * (x * -t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= 0.031) tmp = Float64(x * Float64(1.0 - Float64(y * t))); else tmp = Float64(y * Float64(x * Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= 0.031) tmp = x * (1.0 - (y * t)); else tmp = y * (x * -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, 0.031], N[(x * N[(1.0 - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * (-t)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.031:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \left(-t\right)\right)\\
\end{array}
\end{array}
if y < 0.031Initial program 97.4%
Taylor expanded in t around inf 57.7%
mul-1-neg57.7%
distribute-lft-neg-out57.7%
*-commutative57.7%
Simplified57.7%
Taylor expanded in y around 0 31.1%
associate-*r*31.1%
neg-mul-131.1%
cancel-sign-sub-inv31.1%
Simplified31.1%
if 0.031 < y Initial program 98.5%
Taylor expanded in t around inf 53.1%
mul-1-neg53.1%
distribute-lft-neg-out53.1%
*-commutative53.1%
Simplified53.1%
Taylor expanded in y around 0 14.8%
associate-*r*14.8%
neg-mul-114.8%
cancel-sign-sub-inv14.8%
Simplified14.8%
Taylor expanded in t around inf 17.7%
*-commutative17.7%
*-commutative17.7%
associate-*r*22.1%
neg-mul-122.1%
distribute-rgt-neg-in22.1%
distribute-rgt-neg-in22.1%
Simplified22.1%
Final simplification28.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 97.7%
Taylor expanded in b around inf 55.8%
mul-1-neg55.8%
distribute-rgt-neg-out55.8%
Simplified55.8%
Taylor expanded in a around 0 17.6%
Final simplification17.6%
herbie shell --seed 2024036
(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))))))