
(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 14 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.4%
fma-define97.8%
sub-neg97.8%
log1p-define99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.2e-89) (not (<= y 2.5e-35))) (* x (exp (- (* y (- (log z) t)) (* z a)))) (* x (exp (* a (- (log1p (- z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4.2e-89) || !(y <= 2.5e-35)) {
tmp = x * exp(((y * (log(z) - t)) - (z * a)));
} else {
tmp = x * exp((a * (log1p(-z) - b)));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4.2e-89) || !(y <= 2.5e-35)) {
tmp = x * Math.exp(((y * (Math.log(z) - t)) - (z * a)));
} else {
tmp = x * Math.exp((a * (Math.log1p(-z) - b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4.2e-89) or not (y <= 2.5e-35): tmp = x * math.exp(((y * (math.log(z) - t)) - (z * a))) else: tmp = x * math.exp((a * (math.log1p(-z) - b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -4.2e-89) || !(y <= 2.5e-35)) tmp = Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) - Float64(z * a)))); else tmp = Float64(x * exp(Float64(a * Float64(log1p(Float64(-z)) - b)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -4.2e-89], N[Not[LessEqual[y, 2.5e-35]], $MachinePrecision]], N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] - N[(z * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{-89} \lor \neg \left(y \leq 2.5 \cdot 10^{-35}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right) - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}\\
\end{array}
\end{array}
if y < -4.2000000000000002e-89 or 2.49999999999999982e-35 < y Initial program 97.6%
Taylor expanded in z around 0 99.2%
associate-+r+99.2%
+-commutative99.2%
associate-*r*99.2%
associate-*r*99.2%
distribute-lft-out99.2%
neg-mul-199.2%
Simplified99.2%
Taylor expanded in b around 0 90.8%
+-commutative90.8%
mul-1-neg90.8%
unsub-neg90.8%
*-commutative90.8%
Simplified90.8%
if -4.2000000000000002e-89 < y < 2.49999999999999982e-35Initial program 97.2%
Taylor expanded in y around 0 89.2%
sub-neg89.2%
mul-1-neg89.2%
log1p-define91.1%
mul-1-neg91.1%
Simplified91.1%
Final simplification90.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -0.46) (not (<= y 2.8e-21))) (* x (exp (* y (- (log z) t)))) (* x (exp (* a (- (log1p (- z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -0.46) || !(y <= 2.8e-21)) {
tmp = x * exp((y * (log(z) - t)));
} else {
tmp = x * exp((a * (log1p(-z) - b)));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -0.46) || !(y <= 2.8e-21)) {
tmp = x * Math.exp((y * (Math.log(z) - t)));
} else {
tmp = x * Math.exp((a * (Math.log1p(-z) - b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -0.46) or not (y <= 2.8e-21): tmp = x * math.exp((y * (math.log(z) - t))) else: tmp = x * math.exp((a * (math.log1p(-z) - b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -0.46) || !(y <= 2.8e-21)) tmp = Float64(x * exp(Float64(y * Float64(log(z) - t)))); else tmp = Float64(x * exp(Float64(a * Float64(log1p(Float64(-z)) - b)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -0.46], N[Not[LessEqual[y, 2.8e-21]], $MachinePrecision]], N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.46 \lor \neg \left(y \leq 2.8 \cdot 10^{-21}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}\\
\end{array}
\end{array}
if y < -0.46000000000000002 or 2.80000000000000004e-21 < y Initial program 98.0%
Taylor expanded in y around inf 90.3%
if -0.46000000000000002 < y < 2.80000000000000004e-21Initial program 96.9%
Taylor expanded in y around 0 83.5%
sub-neg83.5%
mul-1-neg83.5%
log1p-define86.6%
mul-1-neg86.6%
Simplified86.6%
Final simplification88.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.8e-89) (not (<= y 9.6e-33))) (* x (exp (* y (- (log z) t)))) (* x (exp (- (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4.8e-89) || !(y <= 9.6e-33)) {
tmp = x * exp((y * (log(z) - 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 ((y <= (-4.8d-89)) .or. (.not. (y <= 9.6d-33))) then
tmp = x * exp((y * (log(z) - 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 ((y <= -4.8e-89) || !(y <= 9.6e-33)) {
tmp = x * Math.exp((y * (Math.log(z) - t)));
} else {
tmp = x * Math.exp(-(a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4.8e-89) or not (y <= 9.6e-33): tmp = x * math.exp((y * (math.log(z) - t))) else: tmp = x * math.exp(-(a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -4.8e-89) || !(y <= 9.6e-33)) tmp = Float64(x * exp(Float64(y * Float64(log(z) - t)))); else tmp = Float64(x * exp(Float64(-Float64(a * b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -4.8e-89) || ~((y <= 9.6e-33))) tmp = x * exp((y * (log(z) - t))); else tmp = x * exp(-(a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -4.8e-89], N[Not[LessEqual[y, 9.6e-33]], $MachinePrecision]], N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[(-N[(a * b), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-89} \lor \neg \left(y \leq 9.6 \cdot 10^{-33}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{-a \cdot b}\\
\end{array}
\end{array}
if y < -4.80000000000000032e-89 or 9.6e-33 < y Initial program 97.6%
Taylor expanded in y around inf 85.9%
if -4.80000000000000032e-89 < y < 9.6e-33Initial program 97.2%
Taylor expanded in b around inf 88.3%
mul-1-neg88.3%
distribute-rgt-neg-out88.3%
Simplified88.3%
Final simplification86.9%
(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 97.4%
Taylor expanded in z around 0 99.2%
associate-+r+99.2%
+-commutative99.2%
associate-*r*99.2%
associate-*r*99.2%
distribute-lft-out99.2%
neg-mul-199.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -7.2e+19) (not (<= y 0.00013))) (* 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 <= -7.2e+19) || !(y <= 0.00013)) {
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 <= (-7.2d+19)) .or. (.not. (y <= 0.00013d0))) 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 <= -7.2e+19) || !(y <= 0.00013)) {
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 <= -7.2e+19) or not (y <= 0.00013): 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 <= -7.2e+19) || !(y <= 0.00013)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * exp(Float64(-Float64(a * b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -7.2e+19) || ~((y <= 0.00013))) 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, -7.2e+19], N[Not[LessEqual[y, 0.00013]], $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 -7.2 \cdot 10^{+19} \lor \neg \left(y \leq 0.00013\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{-a \cdot b}\\
\end{array}
\end{array}
if y < -7.2e19 or 1.29999999999999989e-4 < y Initial program 98.3%
Taylor expanded in y around inf 90.7%
Taylor expanded in t around 0 66.9%
if -7.2e19 < y < 1.29999999999999989e-4Initial program 96.7%
Taylor expanded in b around inf 79.6%
mul-1-neg79.6%
distribute-rgt-neg-out79.6%
Simplified79.6%
Final simplification73.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -5e-19) (not (<= b 7.5e-12))) (* x (exp (- (* a b)))) (* x (exp (* y (- t))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -5e-19) || !(b <= 7.5e-12)) {
tmp = x * exp(-(a * b));
} 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) :: tmp
if ((b <= (-5d-19)) .or. (.not. (b <= 7.5d-12))) then
tmp = x * exp(-(a * b))
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 tmp;
if ((b <= -5e-19) || !(b <= 7.5e-12)) {
tmp = x * Math.exp(-(a * b));
} else {
tmp = x * Math.exp((y * -t));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -5e-19) or not (b <= 7.5e-12): tmp = x * math.exp(-(a * b)) else: tmp = x * math.exp((y * -t)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -5e-19) || !(b <= 7.5e-12)) tmp = Float64(x * exp(Float64(-Float64(a * b)))); else tmp = Float64(x * exp(Float64(y * Float64(-t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -5e-19) || ~((b <= 7.5e-12))) tmp = x * exp(-(a * b)); else tmp = x * exp((y * -t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -5e-19], N[Not[LessEqual[b, 7.5e-12]], $MachinePrecision]], N[(x * N[Exp[(-N[(a * b), $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-19} \lor \neg \left(b \leq 7.5 \cdot 10^{-12}\right):\\
\;\;\;\;x \cdot e^{-a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\end{array}
\end{array}
if b < -5.0000000000000004e-19 or 7.5e-12 < b Initial program 99.2%
Taylor expanded in b around inf 82.0%
mul-1-neg82.0%
distribute-rgt-neg-out82.0%
Simplified82.0%
if -5.0000000000000004e-19 < b < 7.5e-12Initial program 95.7%
Taylor expanded in t around inf 63.4%
mul-1-neg63.4%
distribute-lft-neg-out63.4%
*-commutative63.4%
Simplified63.4%
Final simplification72.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4e-17) (not (<= y 7.2e-5))) (* x (pow z y)) (* x (- 1.0 (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4e-17) || !(y <= 7.2e-5)) {
tmp = x * pow(z, y);
} else {
tmp = x * (1.0 - (a * b));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-4d-17)) .or. (.not. (y <= 7.2d-5))) then
tmp = x * (z ** y)
else
tmp = x * (1.0d0 - (a * b))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4e-17) || !(y <= 7.2e-5)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x * (1.0 - (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4e-17) or not (y <= 7.2e-5): tmp = x * math.pow(z, y) else: tmp = x * (1.0 - (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -4e-17) || !(y <= 7.2e-5)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * Float64(1.0 - Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -4e-17) || ~((y <= 7.2e-5))) tmp = x * (z ^ y); else tmp = x * (1.0 - (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -4e-17], N[Not[LessEqual[y, 7.2e-5]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-17} \lor \neg \left(y \leq 7.2 \cdot 10^{-5}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\end{array}
\end{array}
if y < -4.00000000000000029e-17 or 7.20000000000000018e-5 < y Initial program 98.4%
Taylor expanded in y around inf 89.1%
Taylor expanded in t around 0 64.1%
if -4.00000000000000029e-17 < y < 7.20000000000000018e-5Initial program 96.5%
Taylor expanded in b around inf 81.8%
mul-1-neg81.8%
distribute-rgt-neg-out81.8%
Simplified81.8%
Taylor expanded in a around 0 45.5%
mul-1-neg45.5%
unsub-neg45.5%
Simplified45.5%
Final simplification54.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.65e-67) (not (<= y 1.25e-75))) (* b (* x (- a))) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.65e-67) || !(y <= 1.25e-75)) {
tmp = b * (x * -a);
} 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.65d-67)) .or. (.not. (y <= 1.25d-75))) then
tmp = b * (x * -a)
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.65e-67) || !(y <= 1.25e-75)) {
tmp = b * (x * -a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.65e-67) or not (y <= 1.25e-75): tmp = b * (x * -a) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.65e-67) || !(y <= 1.25e-75)) tmp = Float64(b * Float64(x * Float64(-a))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -2.65e-67) || ~((y <= 1.25e-75))) tmp = b * (x * -a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.65e-67], N[Not[LessEqual[y, 1.25e-75]], $MachinePrecision]], N[(b * N[(x * (-a)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.65 \cdot 10^{-67} \lor \neg \left(y \leq 1.25 \cdot 10^{-75}\right):\\
\;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.64999999999999986e-67 or 1.24999999999999995e-75 < y Initial program 97.6%
Taylor expanded in b around inf 39.3%
mul-1-neg39.3%
distribute-rgt-neg-out39.3%
Simplified39.3%
Taylor expanded in a around 0 15.7%
mul-1-neg15.7%
unsub-neg15.7%
Simplified15.7%
Taylor expanded in a around inf 25.7%
mul-1-neg25.7%
*-commutative25.7%
associate-*r*22.6%
distribute-rgt-neg-in22.6%
Simplified22.6%
if -2.64999999999999986e-67 < y < 1.24999999999999995e-75Initial program 97.2%
Taylor expanded in b around inf 86.3%
mul-1-neg86.3%
distribute-rgt-neg-out86.3%
Simplified86.3%
Taylor expanded in a around 0 34.4%
Final simplification27.4%
(FPCore (x y z t a b) :precision binary64 (if (<= y -3.3e-67) (* x (- (* a b))) (if (<= y 1.85e-64) x (* b (* x (- a))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -3.3e-67) {
tmp = x * -(a * b);
} else if (y <= 1.85e-64) {
tmp = x;
} else {
tmp = b * (x * -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 (y <= (-3.3d-67)) then
tmp = x * -(a * b)
else if (y <= 1.85d-64) then
tmp = x
else
tmp = b * (x * -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 (y <= -3.3e-67) {
tmp = x * -(a * b);
} else if (y <= 1.85e-64) {
tmp = x;
} else {
tmp = b * (x * -a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -3.3e-67: tmp = x * -(a * b) elif y <= 1.85e-64: tmp = x else: tmp = b * (x * -a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -3.3e-67) tmp = Float64(x * Float64(-Float64(a * b))); elseif (y <= 1.85e-64) tmp = x; else tmp = Float64(b * Float64(x * Float64(-a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -3.3e-67) tmp = x * -(a * b); elseif (y <= 1.85e-64) tmp = x; else tmp = b * (x * -a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -3.3e-67], N[(x * (-N[(a * b), $MachinePrecision])), $MachinePrecision], If[LessEqual[y, 1.85e-64], x, N[(b * N[(x * (-a)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-67}:\\
\;\;\;\;x \cdot \left(-a \cdot b\right)\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{-64}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\
\end{array}
\end{array}
if y < -3.3000000000000002e-67Initial program 100.0%
Taylor expanded in b around inf 36.3%
mul-1-neg36.3%
distribute-rgt-neg-out36.3%
Simplified36.3%
Taylor expanded in a around 0 14.6%
mul-1-neg14.6%
unsub-neg14.6%
Simplified14.6%
Taylor expanded in a around inf 20.8%
add020.8%
mul-1-neg20.8%
associate-*r*20.8%
distribute-lft-neg-in20.8%
mul-1-neg20.8%
mul0-lft20.8%
distribute-rgt-in20.8%
add020.8%
mul-1-neg20.8%
*-commutative20.8%
distribute-rgt-neg-in20.8%
Simplified20.8%
if -3.3000000000000002e-67 < y < 1.84999999999999999e-64Initial program 97.2%
Taylor expanded in b around inf 86.3%
mul-1-neg86.3%
distribute-rgt-neg-out86.3%
Simplified86.3%
Taylor expanded in a around 0 34.4%
if 1.84999999999999999e-64 < y Initial program 94.6%
Taylor expanded in b around inf 43.1%
mul-1-neg43.1%
distribute-rgt-neg-out43.1%
Simplified43.1%
Taylor expanded in a around 0 17.2%
mul-1-neg17.2%
unsub-neg17.2%
Simplified17.2%
Taylor expanded in a around inf 32.0%
mul-1-neg32.0%
*-commutative32.0%
associate-*r*30.5%
distribute-rgt-neg-in30.5%
Simplified30.5%
Final simplification28.8%
(FPCore (x y z t a b) :precision binary64 (if (<= x 5e-43) (* a (* x (- z))) (if (<= x 2e+158) x (* x (- (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= 5e-43) {
tmp = a * (x * -z);
} else if (x <= 2e+158) {
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 (x <= 5d-43) then
tmp = a * (x * -z)
else if (x <= 2d+158) 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 (x <= 5e-43) {
tmp = a * (x * -z);
} else if (x <= 2e+158) {
tmp = x;
} else {
tmp = x * -(a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= 5e-43: tmp = a * (x * -z) elif x <= 2e+158: tmp = x else: tmp = x * -(a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= 5e-43) tmp = Float64(a * Float64(x * Float64(-z))); elseif (x <= 2e+158) tmp = x; else tmp = Float64(x * Float64(-Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= 5e-43) tmp = a * (x * -z); elseif (x <= 2e+158) tmp = x; else tmp = x * -(a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, 5e-43], N[(a * N[(x * (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e+158], x, N[(x * (-N[(a * b), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-43}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-z\right)\right)\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+158}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-a \cdot b\right)\\
\end{array}
\end{array}
if x < 5.00000000000000019e-43Initial program 97.5%
Taylor expanded in z around 0 99.5%
associate-+r+99.5%
+-commutative99.5%
associate-*r*99.5%
associate-*r*99.5%
distribute-lft-out99.5%
neg-mul-199.5%
Simplified99.5%
Taylor expanded in z around inf 32.5%
mul-1-neg32.5%
*-commutative32.5%
distribute-rgt-neg-in32.5%
Simplified32.5%
Taylor expanded in z around 0 16.3%
mul-1-neg16.3%
unsub-neg16.3%
Simplified16.3%
Taylor expanded in a around inf 24.4%
associate-*r*24.4%
neg-mul-124.4%
Simplified24.4%
if 5.00000000000000019e-43 < x < 1.99999999999999991e158Initial program 95.5%
Taylor expanded in b around inf 60.2%
mul-1-neg60.2%
distribute-rgt-neg-out60.2%
Simplified60.2%
Taylor expanded in a around 0 21.3%
if 1.99999999999999991e158 < x Initial program 100.0%
Taylor expanded in b around inf 49.0%
mul-1-neg49.0%
distribute-rgt-neg-out49.0%
Simplified49.0%
Taylor expanded in a around 0 37.9%
mul-1-neg37.9%
unsub-neg37.9%
Simplified37.9%
Taylor expanded in a around inf 26.3%
add026.3%
mul-1-neg26.3%
associate-*r*26.4%
distribute-lft-neg-in26.4%
mul-1-neg26.4%
mul0-lft26.4%
distribute-rgt-in26.4%
add026.4%
mul-1-neg26.4%
*-commutative26.4%
distribute-rgt-neg-in26.4%
Simplified26.4%
Final simplification24.1%
(FPCore (x y z t a b) :precision binary64 (if (<= x 7e-29) (* a (* x (- z))) (* x (- 1.0 (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= 7e-29) {
tmp = a * (x * -z);
} 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 (x <= 7d-29) then
tmp = a * (x * -z)
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 (x <= 7e-29) {
tmp = a * (x * -z);
} else {
tmp = x * (1.0 - (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= 7e-29: tmp = a * (x * -z) else: tmp = x * (1.0 - (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= 7e-29) tmp = Float64(a * Float64(x * Float64(-z))); 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 (x <= 7e-29) tmp = a * (x * -z); else tmp = x * (1.0 - (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, 7e-29], N[(a * N[(x * (-z)), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-29}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\end{array}
\end{array}
if x < 6.9999999999999995e-29Initial program 97.6%
Taylor expanded in z around 0 99.5%
associate-+r+99.5%
+-commutative99.5%
associate-*r*99.5%
associate-*r*99.5%
distribute-lft-out99.5%
neg-mul-199.5%
Simplified99.5%
Taylor expanded in z around inf 32.7%
mul-1-neg32.7%
*-commutative32.7%
distribute-rgt-neg-in32.7%
Simplified32.7%
Taylor expanded in z around 0 16.2%
mul-1-neg16.2%
unsub-neg16.2%
Simplified16.2%
Taylor expanded in a around inf 24.2%
associate-*r*24.2%
neg-mul-124.2%
Simplified24.2%
if 6.9999999999999995e-29 < x Initial program 97.2%
Taylor expanded in b around inf 56.0%
mul-1-neg56.0%
distribute-rgt-neg-out56.0%
Simplified56.0%
Taylor expanded in a around 0 34.3%
mul-1-neg34.3%
unsub-neg34.3%
Simplified34.3%
Final simplification27.0%
(FPCore (x y z t a b) :precision binary64 1.0)
double code(double x, double y, double z, double t, double a, double b) {
return 1.0;
}
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 = 1.0d0
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return 1.0;
}
def code(x, y, z, t, a, b): return 1.0
function code(x, y, z, t, a, b) return 1.0 end
function tmp = code(x, y, z, t, a, b) tmp = 1.0; end
code[x_, y_, z_, t_, a_, b_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 97.4%
add-exp-log68.0%
*-commutative68.0%
log-prod44.9%
Applied egg-rr43.0%
add-cube-cbrt42.8%
exp-prod42.7%
cbrt-unprod42.8%
pow242.8%
Applied egg-rr42.8%
Taylor expanded in y around inf 2.7%
Final simplification2.7%
(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.4%
Taylor expanded in b around inf 58.4%
mul-1-neg58.4%
distribute-rgt-neg-out58.4%
Simplified58.4%
Taylor expanded in a around 0 17.2%
Final simplification17.2%
herbie shell --seed 2024034
(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))))))