
(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-define95.7%
sub-neg95.7%
log1p-define98.8%
Simplified98.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.35e-9) (not (<= y 8.5e-9))) (* x (exp (* y (- (log z) t)))) (* x (pow E (* a (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.35e-9) || !(y <= 8.5e-9)) {
tmp = x * exp((y * (log(z) - t)));
} else {
tmp = x * pow(((double) M_E), (a * -b));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.35e-9) || !(y <= 8.5e-9)) {
tmp = x * Math.exp((y * (Math.log(z) - t)));
} else {
tmp = x * Math.pow(Math.E, (a * -b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.35e-9) or not (y <= 8.5e-9): tmp = x * math.exp((y * (math.log(z) - t))) else: tmp = x * math.pow(math.e, (a * -b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.35e-9) || !(y <= 8.5e-9)) tmp = Float64(x * exp(Float64(y * Float64(log(z) - t)))); else tmp = Float64(x * (exp(1) ^ Float64(a * Float64(-b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.35e-9) || ~((y <= 8.5e-9))) tmp = x * exp((y * (log(z) - t))); else tmp = x * (2.71828182845904523536 ^ (a * -b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.35e-9], N[Not[LessEqual[y, 8.5e-9]], $MachinePrecision]], N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[E, N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{-9} \lor \neg \left(y \leq 8.5 \cdot 10^{-9}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {e}^{\left(a \cdot \left(-b\right)\right)}\\
\end{array}
\end{array}
if y < -1.3500000000000001e-9 or 8.5e-9 < y Initial program 96.8%
fma-define96.9%
sub-neg96.9%
log1p-define97.6%
Simplified97.6%
Taylor expanded in a around 0 85.4%
if -1.3500000000000001e-9 < y < 8.5e-9Initial 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%
*-un-lft-identity99.9%
exp-prod100.0%
fma-define100.0%
distribute-lft-neg-out100.0%
fmm-undef100.0%
Applied egg-rr100.0%
Taylor expanded in b around inf 83.9%
neg-mul-183.9%
distribute-rgt-neg-in83.9%
Simplified83.9%
*-un-lft-identity83.9%
exp-1-e83.9%
Applied egg-rr83.9%
*-lft-identity83.9%
Simplified83.9%
Final simplification84.7%
(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.7%
Taylor expanded in z around 0 98.8%
+-commutative98.8%
associate-*r*98.8%
associate-*r*98.8%
distribute-lft-out98.8%
mul-1-neg98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -3.8e+67) (not (<= t 3.5e+180))) (* x (exp (* y (- t)))) (* x (pow E (* a (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -3.8e+67) || !(t <= 3.5e+180)) {
tmp = x * exp((y * -t));
} else {
tmp = x * pow(((double) M_E), (a * -b));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -3.8e+67) || !(t <= 3.5e+180)) {
tmp = x * Math.exp((y * -t));
} else {
tmp = x * Math.pow(Math.E, (a * -b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -3.8e+67) or not (t <= 3.5e+180): tmp = x * math.exp((y * -t)) else: tmp = x * math.pow(math.e, (a * -b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -3.8e+67) || !(t <= 3.5e+180)) tmp = Float64(x * exp(Float64(y * Float64(-t)))); else tmp = Float64(x * (exp(1) ^ Float64(a * Float64(-b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -3.8e+67) || ~((t <= 3.5e+180))) tmp = x * exp((y * -t)); else tmp = x * (2.71828182845904523536 ^ (a * -b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -3.8e+67], N[Not[LessEqual[t, 3.5e+180]], $MachinePrecision]], N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[E, N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+67} \lor \neg \left(t \leq 3.5 \cdot 10^{+180}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {e}^{\left(a \cdot \left(-b\right)\right)}\\
\end{array}
\end{array}
if t < -3.8000000000000002e67 or 3.4999999999999998e180 < t Initial program 95.2%
Taylor expanded in z around 0 96.4%
+-commutative96.4%
associate-*r*96.4%
associate-*r*96.4%
distribute-lft-out96.4%
mul-1-neg96.4%
Simplified96.4%
Taylor expanded in t around inf 87.1%
mul-1-neg87.1%
*-commutative87.1%
distribute-lft-neg-in87.1%
Simplified87.1%
if -3.8000000000000002e67 < t < 3.4999999999999998e180Initial program 96.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%
*-un-lft-identity99.9%
exp-prod99.9%
fma-define99.9%
distribute-lft-neg-out99.9%
fmm-undef99.9%
Applied egg-rr99.9%
Taylor expanded in b around inf 70.0%
neg-mul-170.0%
distribute-rgt-neg-in70.0%
Simplified70.0%
*-un-lft-identity70.0%
exp-1-e70.0%
Applied egg-rr70.0%
*-lft-identity70.0%
Simplified70.0%
Final simplification75.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -4.4e+67) (not (<= t 5.5e+181))) (* x (exp (* y (- t)))) (* x (exp (* a (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -4.4e+67) || !(t <= 5.5e+181)) {
tmp = x * exp((y * -t));
} else {
tmp = x * exp((a * -b));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((t <= (-4.4d+67)) .or. (.not. (t <= 5.5d+181))) then
tmp = x * exp((y * -t))
else
tmp = x * exp((a * -b))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -4.4e+67) || !(t <= 5.5e+181)) {
tmp = x * Math.exp((y * -t));
} else {
tmp = x * Math.exp((a * -b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -4.4e+67) or not (t <= 5.5e+181): tmp = x * math.exp((y * -t)) else: tmp = x * math.exp((a * -b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -4.4e+67) || !(t <= 5.5e+181)) tmp = Float64(x * exp(Float64(y * Float64(-t)))); else tmp = Float64(x * exp(Float64(a * Float64(-b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -4.4e+67) || ~((t <= 5.5e+181))) tmp = x * exp((y * -t)); else tmp = x * exp((a * -b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -4.4e+67], N[Not[LessEqual[t, 5.5e+181]], $MachinePrecision]], N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.4 \cdot 10^{+67} \lor \neg \left(t \leq 5.5 \cdot 10^{+181}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\end{array}
\end{array}
if t < -4.4e67 or 5.49999999999999991e181 < t Initial program 95.2%
Taylor expanded in z around 0 96.4%
+-commutative96.4%
associate-*r*96.4%
associate-*r*96.4%
distribute-lft-out96.4%
mul-1-neg96.4%
Simplified96.4%
Taylor expanded in t around inf 87.1%
mul-1-neg87.1%
*-commutative87.1%
distribute-lft-neg-in87.1%
Simplified87.1%
if -4.4e67 < t < 5.49999999999999991e181Initial program 96.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 b around inf 70.0%
neg-mul-170.0%
distribute-lft-neg-in70.0%
*-commutative70.0%
Simplified70.0%
Final simplification75.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -5e+103) (not (<= y 2.5e+221))) (* 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 <= -5e+103) || !(y <= 2.5e+221)) {
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 <= (-5d+103)) .or. (.not. (y <= 2.5d+221))) 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 <= -5e+103) || !(y <= 2.5e+221)) {
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 <= -5e+103) or not (y <= 2.5e+221): 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 <= -5e+103) || !(y <= 2.5e+221)) 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 <= -5e+103) || ~((y <= 2.5e+221))) 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, -5e+103], N[Not[LessEqual[y, 2.5e+221]], $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 \cdot 10^{+103} \lor \neg \left(y \leq 2.5 \cdot 10^{+221}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\end{array}
\end{array}
if y < -5e103 or 2.5000000000000001e221 < y Initial program 96.0%
fma-define96.1%
sub-neg96.1%
log1p-define96.1%
Simplified96.1%
Taylor expanded in a around 0 98.0%
Taylor expanded in t around 0 76.4%
if -5e103 < y < 2.5000000000000001e221Initial program 95.6%
Taylor expanded in z around 0 99.4%
+-commutative99.4%
associate-*r*99.4%
associate-*r*99.4%
distribute-lft-out99.4%
mul-1-neg99.4%
Simplified99.4%
Taylor expanded in b around inf 72.0%
neg-mul-172.0%
distribute-lft-neg-in72.0%
*-commutative72.0%
Simplified72.0%
Final simplification72.9%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.02e+285) (* x (- 1.0 (* y t))) (if (<= t -125000000000.0) (* x (exp (* a b))) (* x (pow z y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.02e+285) {
tmp = x * (1.0 - (y * t));
} else if (t <= -125000000000.0) {
tmp = x * exp((a * b));
} 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.02d+285)) then
tmp = x * (1.0d0 - (y * t))
else if (t <= (-125000000000.0d0)) then
tmp = x * exp((a * b))
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.02e+285) {
tmp = x * (1.0 - (y * t));
} else if (t <= -125000000000.0) {
tmp = x * Math.exp((a * b));
} else {
tmp = x * Math.pow(z, y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.02e+285: tmp = x * (1.0 - (y * t)) elif t <= -125000000000.0: tmp = x * math.exp((a * b)) else: tmp = x * math.pow(z, y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.02e+285) tmp = Float64(x * Float64(1.0 - Float64(y * t))); elseif (t <= -125000000000.0) tmp = Float64(x * exp(Float64(a * b))); 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.02e+285) tmp = x * (1.0 - (y * t)); elseif (t <= -125000000000.0) tmp = x * exp((a * b)); else tmp = x * (z ^ y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.02e+285], N[(x * N[(1.0 - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -125000000000.0], N[(x * N[Exp[N[(a * b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.02 \cdot 10^{+285}:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\
\mathbf{elif}\;t \leq -125000000000:\\
\;\;\;\;x \cdot e^{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\end{array}
if t < -1.01999999999999996e285Initial program 88.9%
Taylor expanded in z around 0 88.9%
+-commutative88.9%
associate-*r*88.9%
associate-*r*88.9%
distribute-lft-out88.9%
mul-1-neg88.9%
Simplified88.9%
Taylor expanded in t around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
Simplified100.0%
Taylor expanded in y around 0 78.2%
mul-1-neg78.2%
*-commutative78.2%
unsub-neg78.2%
Simplified78.2%
if -1.01999999999999996e285 < t < -1.25e11Initial program 95.4%
Taylor expanded in z around 0 98.4%
+-commutative98.4%
associate-*r*98.4%
associate-*r*98.4%
distribute-lft-out98.4%
mul-1-neg98.4%
Simplified98.4%
Taylor expanded in b around inf 56.4%
neg-mul-156.4%
distribute-lft-neg-in56.4%
*-commutative56.4%
Simplified56.4%
neg-sub056.4%
sub-neg56.4%
add-sqr-sqrt25.2%
sqrt-unprod41.0%
sqr-neg41.0%
sqrt-unprod15.8%
add-sqr-sqrt36.4%
Applied egg-rr36.4%
+-lft-identity36.4%
Simplified36.4%
if -1.25e11 < t Initial program 96.2%
fma-define96.2%
sub-neg96.2%
log1p-define99.4%
Simplified99.4%
Taylor expanded in a around 0 64.0%
Taylor expanded in t around 0 58.4%
Final simplification53.6%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1400.0) (* x (- 1.0 (* y t))) (* x (pow z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1400.0) {
tmp = x * (1.0 - (y * t));
} else {
tmp = x * pow(z, y);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= (-1400.0d0)) then
tmp = x * (1.0d0 - (y * t))
else
tmp = x * (z ** y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1400.0) {
tmp = x * (1.0 - (y * t));
} else {
tmp = x * Math.pow(z, y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1400.0: tmp = x * (1.0 - (y * t)) else: tmp = x * math.pow(z, y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1400.0) tmp = Float64(x * Float64(1.0 - Float64(y * t))); else tmp = Float64(x * (z ^ y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1400.0) tmp = x * (1.0 - (y * t)); else tmp = x * (z ^ y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1400.0], N[(x * N[(1.0 - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1400:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\end{array}
if t < -1400Initial program 94.8%
Taylor expanded in z around 0 97.4%
+-commutative97.4%
associate-*r*97.4%
associate-*r*97.4%
distribute-lft-out97.4%
mul-1-neg97.4%
Simplified97.4%
Taylor expanded in t around inf 77.0%
mul-1-neg77.0%
*-commutative77.0%
distribute-lft-neg-in77.0%
Simplified77.0%
Taylor expanded in y around 0 33.4%
mul-1-neg33.4%
*-commutative33.4%
unsub-neg33.4%
Simplified33.4%
if -1400 < t Initial program 96.1%
fma-define96.1%
sub-neg96.1%
log1p-define99.3%
Simplified99.3%
Taylor expanded in a around 0 64.5%
Taylor expanded in t around 0 59.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.3e+14) (not (<= y 0.1))) (* a (* x (- b))) (* x (- 1.0 (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.3e+14) || !(y <= 0.1)) {
tmp = a * (x * -b);
} 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 <= (-1.3d+14)) .or. (.not. (y <= 0.1d0))) then
tmp = a * (x * -b)
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 <= -1.3e+14) || !(y <= 0.1)) {
tmp = a * (x * -b);
} else {
tmp = x * (1.0 - (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.3e+14) or not (y <= 0.1): tmp = a * (x * -b) else: tmp = x * (1.0 - (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.3e+14) || !(y <= 0.1)) tmp = Float64(a * Float64(x * Float64(-b))); 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 <= -1.3e+14) || ~((y <= 0.1))) tmp = a * (x * -b); else tmp = x * (1.0 - (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.3e+14], N[Not[LessEqual[y, 0.1]], $MachinePrecision]], N[(a * N[(x * (-b)), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+14} \lor \neg \left(y \leq 0.1\right):\\
\;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\end{array}
\end{array}
if y < -1.3e14 or 0.10000000000000001 < y Initial program 96.7%
Taylor expanded in z around 0 97.5%
+-commutative97.5%
associate-*r*97.5%
associate-*r*97.5%
distribute-lft-out97.5%
mul-1-neg97.5%
Simplified97.5%
Taylor expanded in b around inf 38.8%
neg-mul-138.8%
distribute-lft-neg-in38.8%
*-commutative38.8%
Simplified38.8%
Taylor expanded in b around 0 10.2%
neg-mul-110.2%
unsub-neg10.2%
Simplified10.2%
Taylor expanded in a around inf 21.4%
mul-1-neg21.4%
*-commutative21.4%
distribute-rgt-neg-in21.4%
distribute-rgt-neg-in21.4%
Simplified21.4%
if -1.3e14 < y < 0.10000000000000001Initial program 94.8%
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 b around inf 81.5%
neg-mul-181.5%
distribute-lft-neg-in81.5%
*-commutative81.5%
Simplified81.5%
Taylor expanded in b around 0 44.6%
neg-mul-144.6%
unsub-neg44.6%
Simplified44.6%
Final simplification33.5%
(FPCore (x y z t a b) :precision binary64 (if (<= a -6.6e+24) (* x (* a (- b))) (if (<= a 3.2e+185) (* x (- 1.0 (* y t))) (* a (* x (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -6.6e+24) {
tmp = x * (a * -b);
} else if (a <= 3.2e+185) {
tmp = x * (1.0 - (y * t));
} 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 <= (-6.6d+24)) then
tmp = x * (a * -b)
else if (a <= 3.2d+185) then
tmp = x * (1.0d0 - (y * t))
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 <= -6.6e+24) {
tmp = x * (a * -b);
} else if (a <= 3.2e+185) {
tmp = x * (1.0 - (y * t));
} else {
tmp = a * (x * -b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -6.6e+24: tmp = x * (a * -b) elif a <= 3.2e+185: tmp = x * (1.0 - (y * t)) else: tmp = a * (x * -b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -6.6e+24) tmp = Float64(x * Float64(a * Float64(-b))); elseif (a <= 3.2e+185) tmp = Float64(x * Float64(1.0 - Float64(y * t))); 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 (a <= -6.6e+24) tmp = x * (a * -b); elseif (a <= 3.2e+185) tmp = x * (1.0 - (y * t)); else tmp = a * (x * -b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -6.6e+24], N[(x * N[(a * (-b)), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.2e+185], N[(x * N[(1.0 - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(x * (-b)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.6 \cdot 10^{+24}:\\
\;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\
\mathbf{elif}\;a \leq 3.2 \cdot 10^{+185}:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\
\end{array}
\end{array}
if a < -6.5999999999999998e24Initial program 84.3%
Taylor expanded in z around 0 98.2%
+-commutative98.2%
associate-*r*98.2%
associate-*r*98.2%
distribute-lft-out98.2%
mul-1-neg98.2%
Simplified98.2%
Taylor expanded in b around inf 68.6%
neg-mul-168.6%
distribute-lft-neg-in68.6%
*-commutative68.6%
Simplified68.6%
Taylor expanded in b around 0 29.9%
neg-mul-129.9%
unsub-neg29.9%
Simplified29.9%
Taylor expanded in a around inf 27.7%
mul-1-neg27.7%
associate-*r*31.0%
*-commutative31.0%
distribute-rgt-neg-in31.0%
distribute-rgt-neg-in31.0%
Simplified31.0%
if -6.5999999999999998e24 < a < 3.20000000000000006e185Initial program 99.8%
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 62.7%
mul-1-neg62.7%
*-commutative62.7%
distribute-lft-neg-in62.7%
Simplified62.7%
Taylor expanded in y around 0 37.2%
mul-1-neg37.2%
*-commutative37.2%
unsub-neg37.2%
Simplified37.2%
if 3.20000000000000006e185 < a Initial program 92.0%
Taylor expanded in z around 0 92.0%
+-commutative92.0%
associate-*r*92.0%
associate-*r*92.0%
distribute-lft-out92.0%
mul-1-neg92.0%
Simplified92.0%
Taylor expanded in b around inf 80.5%
neg-mul-180.5%
distribute-lft-neg-in80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in b around 0 26.3%
neg-mul-126.3%
unsub-neg26.3%
Simplified26.3%
Taylor expanded in a around inf 34.0%
mul-1-neg34.0%
*-commutative34.0%
distribute-rgt-neg-in34.0%
distribute-rgt-neg-in34.0%
Simplified34.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.8e-21) (not (<= y 2.7e-103))) (* a (* x (- b))) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.8e-21) || !(y <= 2.7e-103)) {
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 <= (-2.8d-21)) .or. (.not. (y <= 2.7d-103))) 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 <= -2.8e-21) || !(y <= 2.7e-103)) {
tmp = a * (x * -b);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.8e-21) or not (y <= 2.7e-103): tmp = a * (x * -b) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.8e-21) || !(y <= 2.7e-103)) tmp = Float64(a * Float64(x * Float64(-b))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -2.8e-21) || ~((y <= 2.7e-103))) tmp = a * (x * -b); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.8e-21], N[Not[LessEqual[y, 2.7e-103]], $MachinePrecision]], N[(a * N[(x * (-b)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{-21} \lor \neg \left(y \leq 2.7 \cdot 10^{-103}\right):\\
\;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.80000000000000004e-21 or 2.7000000000000001e-103 < y Initial program 97.2%
Taylor expanded in z around 0 97.9%
+-commutative97.9%
associate-*r*97.9%
associate-*r*97.9%
distribute-lft-out97.9%
mul-1-neg97.9%
Simplified97.9%
Taylor expanded in b around inf 43.0%
neg-mul-143.0%
distribute-lft-neg-in43.0%
*-commutative43.0%
Simplified43.0%
Taylor expanded in b around 0 14.8%
neg-mul-114.8%
unsub-neg14.8%
Simplified14.8%
Taylor expanded in a around inf 21.5%
mul-1-neg21.5%
*-commutative21.5%
distribute-rgt-neg-in21.5%
distribute-rgt-neg-in21.5%
Simplified21.5%
if -2.80000000000000004e-21 < y < 2.7000000000000001e-103Initial program 93.6%
fma-define93.6%
sub-neg93.6%
log1p-define99.9%
Simplified99.9%
Taylor expanded in a around 0 50.9%
Taylor expanded in y around 0 39.1%
Final simplification28.9%
(FPCore (x y z t a b) :precision binary64 (if (<= y -3e-21) (* a (* x (- b))) (if (<= y 1e-103) x (* x (* a (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -3e-21) {
tmp = a * (x * -b);
} else if (y <= 1e-103) {
tmp = x;
} 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 <= (-3d-21)) then
tmp = a * (x * -b)
else if (y <= 1d-103) then
tmp = x
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 <= -3e-21) {
tmp = a * (x * -b);
} else if (y <= 1e-103) {
tmp = x;
} else {
tmp = x * (a * -b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -3e-21: tmp = a * (x * -b) elif y <= 1e-103: tmp = x else: tmp = x * (a * -b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -3e-21) tmp = Float64(a * Float64(x * Float64(-b))); elseif (y <= 1e-103) tmp = x; 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 <= -3e-21) tmp = a * (x * -b); elseif (y <= 1e-103) tmp = x; else tmp = x * (a * -b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -3e-21], N[(a * N[(x * (-b)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e-103], x, N[(x * N[(a * (-b)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{-21}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\
\mathbf{elif}\;y \leq 10^{-103}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\
\end{array}
\end{array}
if y < -2.99999999999999991e-21Initial program 98.5%
Taylor expanded in z around 0 98.5%
+-commutative98.5%
associate-*r*98.5%
associate-*r*98.5%
distribute-lft-out98.5%
mul-1-neg98.5%
Simplified98.5%
Taylor expanded in b around inf 34.1%
neg-mul-134.1%
distribute-lft-neg-in34.1%
*-commutative34.1%
Simplified34.1%
Taylor expanded in b around 0 7.7%
neg-mul-17.7%
unsub-neg7.7%
Simplified7.7%
Taylor expanded in a around inf 13.4%
mul-1-neg13.4%
*-commutative13.4%
distribute-rgt-neg-in13.4%
distribute-rgt-neg-in13.4%
Simplified13.4%
if -2.99999999999999991e-21 < y < 9.99999999999999958e-104Initial program 93.6%
fma-define93.6%
sub-neg93.6%
log1p-define99.9%
Simplified99.9%
Taylor expanded in a around 0 50.9%
Taylor expanded in y around 0 39.1%
if 9.99999999999999958e-104 < y Initial program 96.0%
Taylor expanded in z around 0 97.3%
+-commutative97.3%
associate-*r*97.3%
associate-*r*97.3%
distribute-lft-out97.3%
mul-1-neg97.3%
Simplified97.3%
Taylor expanded in b around inf 51.0%
neg-mul-151.0%
distribute-lft-neg-in51.0%
*-commutative51.0%
Simplified51.0%
Taylor expanded in b around 0 21.3%
neg-mul-121.3%
unsub-neg21.3%
Simplified21.3%
Taylor expanded in a around inf 28.8%
mul-1-neg28.8%
associate-*r*31.0%
*-commutative31.0%
distribute-rgt-neg-in31.0%
distribute-rgt-neg-in31.0%
Simplified31.0%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 95.7%
fma-define95.7%
sub-neg95.7%
log1p-define98.8%
Simplified98.8%
Taylor expanded in a around 0 68.2%
Taylor expanded in y around 0 19.4%
herbie shell --seed 2024163
(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))))))