
(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.6%
fma-define96.0%
sub-neg96.0%
log1p-define99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.05e+83) (not (<= y 6.5e+98))) (* x (pow (/ z (exp t)) y)) (* x (exp (- (* (- a) (+ z b)) (* y t))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.05e+83) || !(y <= 6.5e+98)) {
tmp = x * pow((z / exp(t)), y);
} else {
tmp = x * exp(((-a * (z + b)) - (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 <= (-1.05d+83)) .or. (.not. (y <= 6.5d+98))) then
tmp = x * ((z / exp(t)) ** y)
else
tmp = x * exp(((-a * (z + b)) - (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 <= -1.05e+83) || !(y <= 6.5e+98)) {
tmp = x * Math.pow((z / Math.exp(t)), y);
} else {
tmp = x * Math.exp(((-a * (z + b)) - (y * t)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.05e+83) or not (y <= 6.5e+98): tmp = x * math.pow((z / math.exp(t)), y) else: tmp = x * math.exp(((-a * (z + b)) - (y * t))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.05e+83) || !(y <= 6.5e+98)) tmp = Float64(x * (Float64(z / exp(t)) ^ y)); else tmp = Float64(x * exp(Float64(Float64(Float64(-a) * Float64(z + b)) - Float64(y * t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.05e+83) || ~((y <= 6.5e+98))) tmp = x * ((z / exp(t)) ^ y); else tmp = x * exp(((-a * (z + b)) - (y * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.05e+83], N[Not[LessEqual[y, 6.5e+98]], $MachinePrecision]], N[(x * N[Power[N[(z / N[Exp[t], $MachinePrecision]), $MachinePrecision], y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(N[((-a) * N[(z + b), $MachinePrecision]), $MachinePrecision] - N[(y * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+83} \lor \neg \left(y \leq 6.5 \cdot 10^{+98}\right):\\
\;\;\;\;x \cdot {\left(\frac{z}{e^{t}}\right)}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-a\right) \cdot \left(z + b\right) - y \cdot t}\\
\end{array}
\end{array}
if y < -1.05000000000000001e83 or 6.4999999999999999e98 < y Initial program 97.6%
fma-define98.8%
sub-neg98.8%
log1p-define98.8%
Simplified98.8%
Taylor expanded in a around 0 92.8%
*-commutative92.8%
exp-prod92.8%
exp-diff92.8%
rem-exp-log92.8%
Simplified92.8%
if -1.05000000000000001e83 < y < 6.4999999999999999e98Initial program 94.6%
Taylor expanded in z around 0 99.9%
+-commutative99.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.7%
neg-mul-196.7%
Simplified96.7%
Final simplification95.4%
(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 95.6%
Taylor expanded in z around 0 99.2%
+-commutative99.2%
associate-*r*99.2%
associate-*r*99.2%
distribute-lft-out99.2%
mul-1-neg99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (pow z y))))
(if (<= y -35000000000.0)
t_1
(if (<= y -3.95e-106)
(* x (exp (* y (- t))))
(if (<= y 2.8e+15) (* x (exp (* a (- b)))) 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 <= -35000000000.0) {
tmp = t_1;
} else if (y <= -3.95e-106) {
tmp = x * exp((y * -t));
} else if (y <= 2.8e+15) {
tmp = x * exp((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 * (z ** y)
if (y <= (-35000000000.0d0)) then
tmp = t_1
else if (y <= (-3.95d-106)) then
tmp = x * exp((y * -t))
else if (y <= 2.8d+15) then
tmp = x * exp((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 * Math.pow(z, y);
double tmp;
if (y <= -35000000000.0) {
tmp = t_1;
} else if (y <= -3.95e-106) {
tmp = x * Math.exp((y * -t));
} else if (y <= 2.8e+15) {
tmp = x * Math.exp((a * -b));
} 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 <= -35000000000.0: tmp = t_1 elif y <= -3.95e-106: tmp = x * math.exp((y * -t)) elif y <= 2.8e+15: tmp = x * math.exp((a * -b)) 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 <= -35000000000.0) tmp = t_1; elseif (y <= -3.95e-106) tmp = Float64(x * exp(Float64(y * Float64(-t)))); elseif (y <= 2.8e+15) tmp = Float64(x * exp(Float64(a * Float64(-b)))); 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 <= -35000000000.0) tmp = t_1; elseif (y <= -3.95e-106) tmp = x * exp((y * -t)); elseif (y <= 2.8e+15) tmp = x * exp((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[Power[z, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -35000000000.0], t$95$1, If[LessEqual[y, -3.95e-106], N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8e+15], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot {z}^{y}\\
\mathbf{if}\;y \leq -35000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.95 \cdot 10^{-106}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+15}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.5e10 or 2.8e15 < y Initial program 97.3%
fma-define98.2%
sub-neg98.2%
log1p-define99.1%
Simplified99.1%
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 74.5%
if -3.5e10 < y < -3.94999999999999993e-106Initial program 100.0%
Taylor expanded in t around inf 70.9%
mul-1-neg70.9%
distribute-lft-neg-out70.9%
*-commutative70.9%
Simplified70.9%
if -3.94999999999999993e-106 < y < 2.8e15Initial program 92.7%
Taylor expanded in b around inf 86.5%
mul-1-neg86.5%
distribute-rgt-neg-out86.5%
Simplified86.5%
Final simplification79.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -6.9e+22) (not (<= b 2.1e+95))) (* x (exp (* a (- b)))) (* x (exp (- (* y (- t)) (* z a))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -6.9e+22) || !(b <= 2.1e+95)) {
tmp = x * exp((a * -b));
} else {
tmp = x * exp(((y * -t) - (z * a)));
}
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 <= (-6.9d+22)) .or. (.not. (b <= 2.1d+95))) then
tmp = x * exp((a * -b))
else
tmp = x * exp(((y * -t) - (z * a)))
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 <= -6.9e+22) || !(b <= 2.1e+95)) {
tmp = x * Math.exp((a * -b));
} else {
tmp = x * Math.exp(((y * -t) - (z * a)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -6.9e+22) or not (b <= 2.1e+95): tmp = x * math.exp((a * -b)) else: tmp = x * math.exp(((y * -t) - (z * a))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -6.9e+22) || !(b <= 2.1e+95)) tmp = Float64(x * exp(Float64(a * Float64(-b)))); else tmp = Float64(x * exp(Float64(Float64(y * Float64(-t)) - Float64(z * a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -6.9e+22) || ~((b <= 2.1e+95))) tmp = x * exp((a * -b)); else tmp = x * exp(((y * -t) - (z * a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -6.9e+22], N[Not[LessEqual[b, 2.1e+95]], $MachinePrecision]], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(N[(y * (-t)), $MachinePrecision] - N[(z * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.9 \cdot 10^{+22} \lor \neg \left(b \leq 2.1 \cdot 10^{+95}\right):\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right) - z \cdot a}\\
\end{array}
\end{array}
if b < -6.8999999999999998e22 or 2.1e95 < b Initial program 98.0%
Taylor expanded in b around inf 78.7%
mul-1-neg78.7%
distribute-rgt-neg-out78.7%
Simplified78.7%
if -6.8999999999999998e22 < b < 2.1e95Initial program 94.0%
Taylor expanded in z around 0 99.9%
+-commutative99.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 88.7%
neg-mul-188.7%
Simplified88.7%
Taylor expanded in b around 0 82.4%
distribute-lft-out82.4%
Simplified82.4%
Final simplification81.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -40000.0) (not (<= y 3.8e+15))) (* 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 <= -40000.0) || !(y <= 3.8e+15)) {
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 <= (-40000.0d0)) .or. (.not. (y <= 3.8d+15))) 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 <= -40000.0) || !(y <= 3.8e+15)) {
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 <= -40000.0) or not (y <= 3.8e+15): 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 <= -40000.0) || !(y <= 3.8e+15)) 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 <= -40000.0) || ~((y <= 3.8e+15))) 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, -40000.0], N[Not[LessEqual[y, 3.8e+15]], $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 -40000 \lor \neg \left(y \leq 3.8 \cdot 10^{+15}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\end{array}
\end{array}
if y < -4e4 or 3.8e15 < y Initial program 97.4%
fma-define98.3%
sub-neg98.3%
log1p-define99.1%
Simplified99.1%
Taylor expanded in a around 0 89.7%
*-commutative89.7%
exp-prod89.7%
exp-diff89.7%
rem-exp-log89.7%
Simplified89.7%
Taylor expanded in t around 0 73.5%
if -4e4 < y < 3.8e15Initial program 94.1%
Taylor expanded in b around inf 80.1%
mul-1-neg80.1%
distribute-rgt-neg-out80.1%
Simplified80.1%
Final simplification77.1%
(FPCore (x y z t a b) :precision binary64 (* x (exp (- (* (- a) (+ z b)) (* y t)))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((-a * (z + b)) - (y * t)));
}
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(((-a * (z + b)) - (y * t)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((-a * (z + b)) - (y * t)));
}
def code(x, y, z, t, a, b): return x * math.exp(((-a * (z + b)) - (y * t)))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(Float64(-a) * Float64(z + b)) - Float64(y * t)))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((-a * (z + b)) - (y * t))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[((-a) * N[(z + b), $MachinePrecision]), $MachinePrecision] - N[(y * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{\left(-a\right) \cdot \left(z + b\right) - y \cdot t}
\end{array}
Initial program 95.6%
Taylor expanded in z around 0 99.2%
+-commutative99.2%
associate-*r*99.2%
associate-*r*99.2%
distribute-lft-out99.2%
mul-1-neg99.2%
Simplified99.2%
Taylor expanded in t around inf 90.4%
neg-mul-190.4%
Simplified90.4%
Final simplification90.4%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.25e+100) (- x (* t (* x y))) (* x (pow z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.25e+100) {
tmp = x - (t * (x * 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 <= (-1.25d+100)) then
tmp = x - (t * (x * 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 <= -1.25e+100) {
tmp = x - (t * (x * y));
} else {
tmp = x * Math.pow(z, y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.25e+100: tmp = x - (t * (x * y)) else: tmp = x * math.pow(z, y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.25e+100) tmp = Float64(x - Float64(t * Float64(x * 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 <= -1.25e+100) tmp = x - (t * (x * y)); else tmp = x * (z ^ y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.25e+100], N[(x - N[(t * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{+100}:\\
\;\;\;\;x - t \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\end{array}
if t < -1.25e100Initial program 96.8%
Taylor expanded in t around inf 93.5%
mul-1-neg93.5%
distribute-lft-neg-out93.5%
*-commutative93.5%
Simplified93.5%
Taylor expanded in y around 0 38.9%
mul-1-neg38.9%
unsub-neg38.9%
associate-*r*38.4%
Simplified38.4%
Taylor expanded in t around 0 38.9%
*-commutative38.9%
Simplified38.9%
if -1.25e100 < t Initial program 95.4%
fma-define95.9%
sub-neg95.9%
log1p-define99.5%
Simplified99.5%
Taylor expanded in a around 0 69.8%
*-commutative69.8%
exp-prod67.6%
exp-diff67.6%
rem-exp-log67.6%
Simplified67.6%
Taylor expanded in t around 0 63.8%
Final simplification60.9%
(FPCore (x y z t a b) :precision binary64 (if (<= a -8.5e-69) (* x (- 1.0 (* a b))) (if (<= a 4.8e+207) (- x (* t (* x y))) (* a (- (* x b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -8.5e-69) {
tmp = x * (1.0 - (a * b));
} else if (a <= 4.8e+207) {
tmp = x - (t * (x * y));
} 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 (a <= (-8.5d-69)) then
tmp = x * (1.0d0 - (a * b))
else if (a <= 4.8d+207) then
tmp = x - (t * (x * y))
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 (a <= -8.5e-69) {
tmp = x * (1.0 - (a * b));
} else if (a <= 4.8e+207) {
tmp = x - (t * (x * y));
} else {
tmp = a * -(x * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -8.5e-69: tmp = x * (1.0 - (a * b)) elif a <= 4.8e+207: tmp = x - (t * (x * y)) else: tmp = a * -(x * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -8.5e-69) tmp = Float64(x * Float64(1.0 - Float64(a * b))); elseif (a <= 4.8e+207) tmp = Float64(x - Float64(t * Float64(x * y))); else tmp = Float64(a * Float64(-Float64(x * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -8.5e-69) tmp = x * (1.0 - (a * b)); elseif (a <= 4.8e+207) tmp = x - (t * (x * y)); else tmp = a * -(x * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -8.5e-69], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.8e+207], N[(x - N[(t * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * (-N[(x * b), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.5 \cdot 10^{-69}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\mathbf{elif}\;a \leq 4.8 \cdot 10^{+207}:\\
\;\;\;\;x - t \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(-x \cdot b\right)\\
\end{array}
\end{array}
if a < -8.50000000000000046e-69Initial program 94.2%
Taylor expanded in b around inf 71.3%
mul-1-neg71.3%
distribute-rgt-neg-out71.3%
Simplified71.3%
Taylor expanded in a around 0 30.0%
mul-1-neg30.0%
unsub-neg30.0%
Simplified30.0%
Taylor expanded in x around 0 34.2%
if -8.50000000000000046e-69 < a < 4.8000000000000002e207Initial program 97.3%
Taylor expanded in t around inf 71.1%
mul-1-neg71.1%
distribute-lft-neg-out71.1%
*-commutative71.1%
Simplified71.1%
Taylor expanded in y around 0 43.1%
mul-1-neg43.1%
unsub-neg43.1%
associate-*r*40.8%
Simplified40.8%
Taylor expanded in t around 0 43.1%
*-commutative43.1%
Simplified43.1%
if 4.8000000000000002e207 < a Initial program 84.6%
Taylor expanded in b around inf 79.6%
mul-1-neg79.6%
distribute-rgt-neg-out79.6%
Simplified79.6%
Taylor expanded in a around 0 24.4%
mul-1-neg24.4%
unsub-neg24.4%
Simplified24.4%
Taylor expanded in a around inf 39.1%
mul-1-neg39.1%
*-commutative39.1%
distribute-rgt-neg-in39.1%
distribute-rgt-neg-in39.1%
Simplified39.1%
Final simplification40.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.6e-25) (not (<= y 0.00074))) (* a (- (* x b))) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.6e-25) || !(y <= 0.00074)) {
tmp = a * -(x * b);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-1.6d-25)) .or. (.not. (y <= 0.00074d0))) then
tmp = a * -(x * b)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.6e-25) || !(y <= 0.00074)) {
tmp = a * -(x * b);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.6e-25) or not (y <= 0.00074): tmp = a * -(x * b) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.6e-25) || !(y <= 0.00074)) tmp = Float64(a * Float64(-Float64(x * b))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.6e-25) || ~((y <= 0.00074))) tmp = a * -(x * b); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.6e-25], N[Not[LessEqual[y, 0.00074]], $MachinePrecision]], N[(a * (-N[(x * b), $MachinePrecision])), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{-25} \lor \neg \left(y \leq 0.00074\right):\\
\;\;\;\;a \cdot \left(-x \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.6000000000000001e-25 or 7.3999999999999999e-4 < y Initial program 97.7%
Taylor expanded in b around inf 42.4%
mul-1-neg42.4%
distribute-rgt-neg-out42.4%
Simplified42.4%
Taylor expanded in a around 0 13.6%
mul-1-neg13.6%
unsub-neg13.6%
Simplified13.6%
Taylor expanded in a around inf 18.5%
mul-1-neg18.5%
*-commutative18.5%
distribute-rgt-neg-in18.5%
distribute-rgt-neg-in18.5%
Simplified18.5%
if -1.6000000000000001e-25 < y < 7.3999999999999999e-4Initial program 93.5%
Taylor expanded in b around inf 81.2%
mul-1-neg81.2%
distribute-rgt-neg-out81.2%
Simplified81.2%
Taylor expanded in a around 0 47.5%
Final simplification33.0%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.7e-25) (* a (- (* x b))) (if (<= y 16500000000000.0) x (* a (- (* x z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.7e-25) {
tmp = a * -(x * b);
} else if (y <= 16500000000000.0) {
tmp = x;
} else {
tmp = a * -(x * z);
}
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.7d-25)) then
tmp = a * -(x * b)
else if (y <= 16500000000000.0d0) then
tmp = x
else
tmp = a * -(x * z)
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.7e-25) {
tmp = a * -(x * b);
} else if (y <= 16500000000000.0) {
tmp = x;
} else {
tmp = a * -(x * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.7e-25: tmp = a * -(x * b) elif y <= 16500000000000.0: tmp = x else: tmp = a * -(x * z) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.7e-25) tmp = Float64(a * Float64(-Float64(x * b))); elseif (y <= 16500000000000.0) tmp = x; else tmp = Float64(a * Float64(-Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1.7e-25) tmp = a * -(x * b); elseif (y <= 16500000000000.0) tmp = x; else tmp = a * -(x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.7e-25], N[(a * (-N[(x * b), $MachinePrecision])), $MachinePrecision], If[LessEqual[y, 16500000000000.0], x, N[(a * (-N[(x * z), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{-25}:\\
\;\;\;\;a \cdot \left(-x \cdot b\right)\\
\mathbf{elif}\;y \leq 16500000000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(-x \cdot z\right)\\
\end{array}
\end{array}
if y < -1.70000000000000001e-25Initial program 98.5%
Taylor expanded in b around inf 39.6%
mul-1-neg39.6%
distribute-rgt-neg-out39.6%
Simplified39.6%
Taylor expanded in a around 0 13.0%
mul-1-neg13.0%
unsub-neg13.0%
Simplified13.0%
Taylor expanded in a around inf 18.4%
mul-1-neg18.4%
*-commutative18.4%
distribute-rgt-neg-in18.4%
distribute-rgt-neg-in18.4%
Simplified18.4%
if -1.70000000000000001e-25 < y < 1.65e13Initial program 93.6%
Taylor expanded in b around inf 81.7%
mul-1-neg81.7%
distribute-rgt-neg-out81.7%
Simplified81.7%
Taylor expanded in a around 0 46.5%
if 1.65e13 < y Initial program 96.6%
Taylor expanded in z around 0 98.3%
+-commutative98.3%
associate-*r*98.3%
associate-*r*98.3%
distribute-lft-out98.3%
mul-1-neg98.3%
Simplified98.3%
Taylor expanded in z around inf 26.6%
associate-*r*26.6%
mul-1-neg26.6%
Simplified26.6%
Taylor expanded in a around 0 3.6%
mul-1-neg3.6%
unsub-neg3.6%
associate-*r*5.0%
*-commutative5.0%
Simplified5.0%
Taylor expanded in z around inf 19.7%
associate-*r*19.7%
neg-mul-119.7%
*-commutative19.7%
Simplified19.7%
Final simplification33.1%
(FPCore (x y z t a b) :precision binary64 (* x (- 1.0 (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
return x * (1.0 - (a * 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 * (1.0d0 - (a * b))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * (1.0 - (a * b));
}
def code(x, y, z, t, a, b): return x * (1.0 - (a * b))
function code(x, y, z, t, a, b) return Float64(x * Float64(1.0 - Float64(a * b))) end
function tmp = code(x, y, z, t, a, b) tmp = x * (1.0 - (a * b)); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - a \cdot b\right)
\end{array}
Initial program 95.6%
Taylor expanded in b around inf 61.8%
mul-1-neg61.8%
distribute-rgt-neg-out61.8%
Simplified61.8%
Taylor expanded in a around 0 33.8%
mul-1-neg33.8%
unsub-neg33.8%
Simplified33.8%
Taylor expanded in x around 0 34.9%
Final simplification34.9%
(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.6%
Taylor expanded in b around inf 61.8%
mul-1-neg61.8%
distribute-rgt-neg-out61.8%
Simplified61.8%
Taylor expanded in a around 0 26.0%
Final simplification26.0%
herbie shell --seed 2024115
(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))))))