
(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 95.8%
fma-define95.8%
sub-neg95.8%
log1p-define99.6%
Simplified99.6%
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
Initial program 95.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.14e+18) (not (<= y 170000.0))) (* x (exp (* y (- (log z) t)))) (* x (exp (* (- a) (+ z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.14e+18) || !(y <= 170000.0)) {
tmp = x * exp((y * (log(z) - t)));
} else {
tmp = x * exp((-a * (z + b)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-1.14d+18)) .or. (.not. (y <= 170000.0d0))) then
tmp = x * exp((y * (log(z) - t)))
else
tmp = x * exp((-a * (z + b)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.14e+18) || !(y <= 170000.0)) {
tmp = x * Math.exp((y * (Math.log(z) - t)));
} else {
tmp = x * Math.exp((-a * (z + b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.14e+18) or not (y <= 170000.0): tmp = x * math.exp((y * (math.log(z) - t))) else: tmp = x * math.exp((-a * (z + b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.14e+18) || !(y <= 170000.0)) tmp = Float64(x * exp(Float64(y * Float64(log(z) - t)))); else tmp = Float64(x * exp(Float64(Float64(-a) * Float64(z + b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.14e+18) || ~((y <= 170000.0))) tmp = x * exp((y * (log(z) - t))); else tmp = x * exp((-a * (z + b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.14e+18], N[Not[LessEqual[y, 170000.0]], $MachinePrecision]], N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[((-a) * N[(z + b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.14 \cdot 10^{+18} \lor \neg \left(y \leq 170000\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-a\right) \cdot \left(z + b\right)}\\
\end{array}
\end{array}
if y < -1.14e18 or 1.7e5 < y Initial program 99.2%
Taylor expanded in y around inf 89.5%
if -1.14e18 < y < 1.7e5Initial program 92.7%
Taylor expanded in y around 0 79.1%
sub-neg79.1%
sub-neg79.1%
sub-neg79.1%
mul-1-neg79.1%
log1p-define86.4%
mul-1-neg86.4%
Simplified86.4%
Taylor expanded in z around 0 86.4%
associate-*r*86.4%
associate-*r*86.4%
distribute-lft-out86.4%
mul-1-neg86.4%
Simplified86.4%
Final simplification87.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (exp (* a (- b))))))
(if (<= b -1.8e-43)
t_1
(if (<= b 2e-300)
(* x (pow z y))
(if (<= b 2.6e+95) (* x (exp (* y (- t)))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * exp((a * -b));
double tmp;
if (b <= -1.8e-43) {
tmp = t_1;
} else if (b <= 2e-300) {
tmp = x * pow(z, y);
} else if (b <= 2.6e+95) {
tmp = x * exp((y * -t));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x * exp((a * -b))
if (b <= (-1.8d-43)) then
tmp = t_1
else if (b <= 2d-300) then
tmp = x * (z ** y)
else if (b <= 2.6d+95) then
tmp = x * exp((y * -t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * Math.exp((a * -b));
double tmp;
if (b <= -1.8e-43) {
tmp = t_1;
} else if (b <= 2e-300) {
tmp = x * Math.pow(z, y);
} else if (b <= 2.6e+95) {
tmp = x * Math.exp((y * -t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.exp((a * -b)) tmp = 0 if b <= -1.8e-43: tmp = t_1 elif b <= 2e-300: tmp = x * math.pow(z, y) elif b <= 2.6e+95: tmp = x * math.exp((y * -t)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * exp(Float64(a * Float64(-b)))) tmp = 0.0 if (b <= -1.8e-43) tmp = t_1; elseif (b <= 2e-300) tmp = Float64(x * (z ^ y)); elseif (b <= 2.6e+95) tmp = Float64(x * exp(Float64(y * Float64(-t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * exp((a * -b)); tmp = 0.0; if (b <= -1.8e-43) tmp = t_1; elseif (b <= 2e-300) tmp = x * (z ^ y); elseif (b <= 2.6e+95) tmp = x * exp((y * -t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.8e-43], t$95$1, If[LessEqual[b, 2e-300], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.6e+95], N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot e^{a \cdot \left(-b\right)}\\
\mathbf{if}\;b \leq -1.8 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 2 \cdot 10^{-300}:\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{elif}\;b \leq 2.6 \cdot 10^{+95}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.7999999999999999e-43 or 2.5999999999999999e95 < b Initial program 98.3%
Taylor expanded in b around inf 79.6%
mul-1-neg79.6%
distribute-rgt-neg-out79.6%
Simplified79.6%
if -1.7999999999999999e-43 < b < 2.00000000000000005e-300Initial program 90.5%
Taylor expanded in y around inf 85.8%
Taylor expanded in t around 0 73.4%
if 2.00000000000000005e-300 < b < 2.5999999999999999e95Initial program 96.1%
Taylor expanded in t around inf 71.3%
mul-1-neg71.3%
distribute-lft-neg-out71.3%
*-commutative71.3%
Simplified71.3%
(FPCore (x y z t a b) :precision binary64 (if (<= y -2.5e+62) (* x (exp (* y (- t)))) (if (<= y 175000.0) (* x (exp (* (- a) (+ z b)))) (* x (pow z y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -2.5e+62) {
tmp = x * exp((y * -t));
} else if (y <= 175000.0) {
tmp = x * exp((-a * (z + 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 (y <= (-2.5d+62)) then
tmp = x * exp((y * -t))
else if (y <= 175000.0d0) then
tmp = x * exp((-a * (z + 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 (y <= -2.5e+62) {
tmp = x * Math.exp((y * -t));
} else if (y <= 175000.0) {
tmp = x * Math.exp((-a * (z + b)));
} else {
tmp = x * Math.pow(z, y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -2.5e+62: tmp = x * math.exp((y * -t)) elif y <= 175000.0: tmp = x * math.exp((-a * (z + b))) else: tmp = x * math.pow(z, y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -2.5e+62) tmp = Float64(x * exp(Float64(y * Float64(-t)))); elseif (y <= 175000.0) tmp = Float64(x * exp(Float64(Float64(-a) * Float64(z + 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 (y <= -2.5e+62) tmp = x * exp((y * -t)); elseif (y <= 175000.0) tmp = x * exp((-a * (z + b))); else tmp = x * (z ^ y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -2.5e+62], N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 175000.0], N[(x * N[Exp[N[((-a) * N[(z + b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+62}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{elif}\;y \leq 175000:\\
\;\;\;\;x \cdot e^{\left(-a\right) \cdot \left(z + b\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\end{array}
if y < -2.50000000000000014e62Initial program 98.0%
Taylor expanded in t around inf 72.3%
mul-1-neg72.3%
distribute-lft-neg-out72.3%
*-commutative72.3%
Simplified72.3%
if -2.50000000000000014e62 < y < 175000Initial program 93.5%
Taylor expanded in y around 0 76.4%
sub-neg76.4%
sub-neg76.4%
sub-neg76.4%
mul-1-neg76.4%
log1p-define82.8%
mul-1-neg82.8%
Simplified82.8%
Taylor expanded in z around 0 82.8%
associate-*r*82.8%
associate-*r*82.8%
distribute-lft-out82.8%
mul-1-neg82.8%
Simplified82.8%
if 175000 < y Initial program 100.0%
Taylor expanded in y around inf 91.2%
Taylor expanded in t around 0 70.1%
Final simplification78.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -3.1e+18) (not (<= y 140000.0))) (* 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 <= -3.1e+18) || !(y <= 140000.0)) {
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 <= (-3.1d+18)) .or. (.not. (y <= 140000.0d0))) 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 <= -3.1e+18) || !(y <= 140000.0)) {
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 <= -3.1e+18) or not (y <= 140000.0): 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 <= -3.1e+18) || !(y <= 140000.0)) 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 <= -3.1e+18) || ~((y <= 140000.0))) 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, -3.1e+18], N[Not[LessEqual[y, 140000.0]], $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 -3.1 \cdot 10^{+18} \lor \neg \left(y \leq 140000\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\end{array}
\end{array}
if y < -3.1e18 or 1.4e5 < y Initial program 99.2%
Taylor expanded in y around inf 89.5%
Taylor expanded in t around 0 66.9%
if -3.1e18 < y < 1.4e5Initial program 92.7%
Taylor expanded in b around inf 78.4%
mul-1-neg78.4%
distribute-rgt-neg-out78.4%
Simplified78.4%
Final simplification72.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -7.8e-16) (not (<= y 2.7e-11))) (* x (pow z y)) (* x (- 1.0 (* a (+ z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -7.8e-16) || !(y <= 2.7e-11)) {
tmp = x * pow(z, y);
} else {
tmp = x * (1.0 - (a * (z + b)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-7.8d-16)) .or. (.not. (y <= 2.7d-11))) then
tmp = x * (z ** y)
else
tmp = x * (1.0d0 - (a * (z + b)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -7.8e-16) || !(y <= 2.7e-11)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x * (1.0 - (a * (z + b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -7.8e-16) or not (y <= 2.7e-11): tmp = x * math.pow(z, y) else: tmp = x * (1.0 - (a * (z + b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -7.8e-16) || !(y <= 2.7e-11)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * Float64(1.0 - Float64(a * Float64(z + b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -7.8e-16) || ~((y <= 2.7e-11))) tmp = x * (z ^ y); else tmp = x * (1.0 - (a * (z + b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -7.8e-16], N[Not[LessEqual[y, 2.7e-11]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(a * N[(z + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{-16} \lor \neg \left(y \leq 2.7 \cdot 10^{-11}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - a \cdot \left(z + b\right)\right)\\
\end{array}
\end{array}
if y < -7.79999999999999954e-16 or 2.70000000000000005e-11 < y Initial program 99.2%
Taylor expanded in y around inf 86.9%
Taylor expanded in t around 0 65.2%
if -7.79999999999999954e-16 < y < 2.70000000000000005e-11Initial program 92.4%
Taylor expanded in y around 0 78.3%
sub-neg78.3%
sub-neg78.3%
sub-neg78.3%
mul-1-neg78.3%
log1p-define85.9%
mul-1-neg85.9%
Simplified85.9%
Taylor expanded in z around 0 85.9%
associate-*r*85.9%
associate-*r*85.9%
distribute-lft-out85.9%
mul-1-neg85.9%
Simplified85.9%
Taylor expanded in a around 0 50.6%
neg-mul-150.6%
unsub-neg50.6%
Simplified50.6%
Final simplification57.8%
(FPCore (x y z t a b) :precision binary64 (if (<= x 1.15e-219) (* y (/ x y)) (if (<= x 1.12e-121) (* x (* y (- t))) (* x (- 1.0 (* a (+ z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= 1.15e-219) {
tmp = y * (x / y);
} else if (x <= 1.12e-121) {
tmp = x * (y * -t);
} else {
tmp = x * (1.0 - (a * (z + b)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= 1.15d-219) then
tmp = y * (x / y)
else if (x <= 1.12d-121) then
tmp = x * (y * -t)
else
tmp = x * (1.0d0 - (a * (z + b)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= 1.15e-219) {
tmp = y * (x / y);
} else if (x <= 1.12e-121) {
tmp = x * (y * -t);
} else {
tmp = x * (1.0 - (a * (z + b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= 1.15e-219: tmp = y * (x / y) elif x <= 1.12e-121: tmp = x * (y * -t) else: tmp = x * (1.0 - (a * (z + b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= 1.15e-219) tmp = Float64(y * Float64(x / y)); elseif (x <= 1.12e-121) tmp = Float64(x * Float64(y * Float64(-t))); else tmp = Float64(x * Float64(1.0 - Float64(a * Float64(z + b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= 1.15e-219) tmp = y * (x / y); elseif (x <= 1.12e-121) tmp = x * (y * -t); else tmp = x * (1.0 - (a * (z + b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, 1.15e-219], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.12e-121], N[(x * N[(y * (-t)), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(a * N[(z + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.15 \cdot 10^{-219}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-121}:\\
\;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - a \cdot \left(z + b\right)\right)\\
\end{array}
\end{array}
if x < 1.14999999999999994e-219Initial program 96.3%
Taylor expanded in t around inf 54.3%
mul-1-neg54.3%
distribute-lft-neg-out54.3%
*-commutative54.3%
Simplified54.3%
Taylor expanded in y around 0 24.3%
mul-1-neg24.3%
*-commutative24.3%
unsub-neg24.3%
*-commutative24.3%
Simplified24.3%
Taylor expanded in y around inf 26.0%
+-commutative26.0%
mul-1-neg26.0%
sub-neg26.0%
*-commutative26.0%
Simplified26.0%
Taylor expanded in y around 0 28.2%
if 1.14999999999999994e-219 < x < 1.12e-121Initial program 95.5%
Taylor expanded in t around inf 60.5%
mul-1-neg60.5%
distribute-lft-neg-out60.5%
*-commutative60.5%
Simplified60.5%
Taylor expanded in y around 0 34.1%
mul-1-neg34.1%
*-commutative34.1%
unsub-neg34.1%
*-commutative34.1%
Simplified34.1%
Taylor expanded in t around inf 21.8%
mul-1-neg21.8%
distribute-rgt-neg-in21.8%
*-commutative21.8%
distribute-lft-neg-in21.8%
associate-*l*38.4%
*-commutative38.4%
Simplified38.4%
if 1.12e-121 < x Initial program 94.7%
Taylor expanded in y around 0 60.0%
sub-neg60.0%
sub-neg60.0%
sub-neg60.0%
mul-1-neg60.0%
log1p-define67.8%
mul-1-neg67.8%
Simplified67.8%
Taylor expanded in z around 0 67.8%
associate-*r*67.8%
associate-*r*67.8%
distribute-lft-out67.8%
mul-1-neg67.8%
Simplified67.8%
Taylor expanded in a around 0 35.6%
neg-mul-135.6%
unsub-neg35.6%
Simplified35.6%
Final simplification31.2%
(FPCore (x y z t a b) :precision binary64 (if (<= x 1.15e-219) (* y (/ x y)) (if (<= x 1.6e-121) (* x (* y (- t))) (* x (- 1.0 (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= 1.15e-219) {
tmp = y * (x / y);
} else if (x <= 1.6e-121) {
tmp = x * (y * -t);
} 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 <= 1.15d-219) then
tmp = y * (x / y)
else if (x <= 1.6d-121) then
tmp = x * (y * -t)
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 <= 1.15e-219) {
tmp = y * (x / y);
} else if (x <= 1.6e-121) {
tmp = x * (y * -t);
} else {
tmp = x * (1.0 - (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= 1.15e-219: tmp = y * (x / y) elif x <= 1.6e-121: tmp = x * (y * -t) else: tmp = x * (1.0 - (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= 1.15e-219) tmp = Float64(y * Float64(x / y)); elseif (x <= 1.6e-121) tmp = Float64(x * Float64(y * Float64(-t))); 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 <= 1.15e-219) tmp = y * (x / y); elseif (x <= 1.6e-121) tmp = x * (y * -t); else tmp = x * (1.0 - (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, 1.15e-219], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.6e-121], N[(x * N[(y * (-t)), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.15 \cdot 10^{-219}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-121}:\\
\;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\end{array}
\end{array}
if x < 1.14999999999999994e-219Initial program 96.3%
Taylor expanded in t around inf 54.3%
mul-1-neg54.3%
distribute-lft-neg-out54.3%
*-commutative54.3%
Simplified54.3%
Taylor expanded in y around 0 24.3%
mul-1-neg24.3%
*-commutative24.3%
unsub-neg24.3%
*-commutative24.3%
Simplified24.3%
Taylor expanded in y around inf 26.0%
+-commutative26.0%
mul-1-neg26.0%
sub-neg26.0%
*-commutative26.0%
Simplified26.0%
Taylor expanded in y around 0 28.2%
if 1.14999999999999994e-219 < x < 1.60000000000000009e-121Initial program 95.5%
Taylor expanded in t around inf 60.5%
mul-1-neg60.5%
distribute-lft-neg-out60.5%
*-commutative60.5%
Simplified60.5%
Taylor expanded in y around 0 34.1%
mul-1-neg34.1%
*-commutative34.1%
unsub-neg34.1%
*-commutative34.1%
Simplified34.1%
Taylor expanded in t around inf 21.8%
mul-1-neg21.8%
distribute-rgt-neg-in21.8%
*-commutative21.8%
distribute-lft-neg-in21.8%
associate-*l*38.4%
*-commutative38.4%
Simplified38.4%
if 1.60000000000000009e-121 < x Initial program 94.7%
Taylor expanded in b around inf 60.0%
mul-1-neg60.0%
distribute-rgt-neg-out60.0%
Simplified60.0%
Taylor expanded in a around 0 34.2%
neg-mul-134.2%
unsub-neg34.2%
Simplified34.2%
Final simplification30.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z 3.6e-166) (not (<= z 1.16e-66))) (* y (/ x y)) (* (- a) (* x b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= 3.6e-166) || !(z <= 1.16e-66)) {
tmp = y * (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 ((z <= 3.6d-166) .or. (.not. (z <= 1.16d-66))) then
tmp = y * (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 ((z <= 3.6e-166) || !(z <= 1.16e-66)) {
tmp = y * (x / y);
} else {
tmp = -a * (x * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= 3.6e-166) or not (z <= 1.16e-66): tmp = y * (x / y) else: tmp = -a * (x * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= 3.6e-166) || !(z <= 1.16e-66)) tmp = Float64(y * Float64(x / y)); else tmp = Float64(Float64(-a) * Float64(x * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= 3.6e-166) || ~((z <= 1.16e-66))) tmp = y * (x / y); else tmp = -a * (x * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, 3.6e-166], N[Not[LessEqual[z, 1.16e-66]], $MachinePrecision]], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], N[((-a) * N[(x * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.6 \cdot 10^{-166} \lor \neg \left(z \leq 1.16 \cdot 10^{-66}\right):\\
\;\;\;\;y \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(-a\right) \cdot \left(x \cdot b\right)\\
\end{array}
\end{array}
if z < 3.6000000000000001e-166 or 1.16000000000000002e-66 < z Initial program 95.8%
Taylor expanded in t around inf 59.3%
mul-1-neg59.3%
distribute-lft-neg-out59.3%
*-commutative59.3%
Simplified59.3%
Taylor expanded in y around 0 30.3%
mul-1-neg30.3%
*-commutative30.3%
unsub-neg30.3%
*-commutative30.3%
Simplified30.3%
Taylor expanded in y around inf 28.3%
+-commutative28.3%
mul-1-neg28.3%
sub-neg28.3%
*-commutative28.3%
Simplified28.3%
Taylor expanded in y around 0 29.6%
if 3.6000000000000001e-166 < z < 1.16000000000000002e-66Initial program 95.7%
Taylor expanded in b around inf 65.0%
mul-1-neg65.0%
distribute-rgt-neg-out65.0%
Simplified65.0%
Taylor expanded in a around 0 25.8%
mul-1-neg25.8%
unsub-neg25.8%
*-commutative25.8%
Simplified25.8%
Taylor expanded in a around inf 25.6%
associate-*r*25.6%
mul-1-neg25.6%
*-commutative25.6%
Simplified25.6%
Final simplification28.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -3.6e+16) (not (<= y 7.2e-11))) (* x (* y (- t))) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -3.6e+16) || !(y <= 7.2e-11)) {
tmp = x * (y * -t);
} 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 <= (-3.6d+16)) .or. (.not. (y <= 7.2d-11))) then
tmp = x * (y * -t)
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 <= -3.6e+16) || !(y <= 7.2e-11)) {
tmp = x * (y * -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -3.6e+16) or not (y <= 7.2e-11): tmp = x * (y * -t) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -3.6e+16) || !(y <= 7.2e-11)) tmp = Float64(x * Float64(y * Float64(-t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -3.6e+16) || ~((y <= 7.2e-11))) tmp = x * (y * -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -3.6e+16], N[Not[LessEqual[y, 7.2e-11]], $MachinePrecision]], N[(x * N[(y * (-t)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.6 \cdot 10^{+16} \lor \neg \left(y \leq 7.2 \cdot 10^{-11}\right):\\
\;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.6e16 or 7.19999999999999969e-11 < y Initial program 99.2%
Taylor expanded in t around inf 60.5%
mul-1-neg60.5%
distribute-lft-neg-out60.5%
*-commutative60.5%
Simplified60.5%
Taylor expanded in y around 0 17.6%
mul-1-neg17.6%
*-commutative17.6%
unsub-neg17.6%
*-commutative17.6%
Simplified17.6%
Taylor expanded in t around inf 18.9%
mul-1-neg18.9%
distribute-rgt-neg-in18.9%
*-commutative18.9%
distribute-lft-neg-in18.9%
associate-*l*21.8%
*-commutative21.8%
Simplified21.8%
if -3.6e16 < y < 7.19999999999999969e-11Initial program 92.5%
Taylor expanded in b around inf 77.9%
mul-1-neg77.9%
distribute-rgt-neg-out77.9%
Simplified77.9%
Taylor expanded in a around 0 32.7%
Final simplification27.4%
(FPCore (x y z t a b) :precision binary64 (if (<= b 9e-46) x (* t (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= 9e-46) {
tmp = x;
} else {
tmp = t * (x * 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 (b <= 9d-46) then
tmp = x
else
tmp = t * (x * 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 (b <= 9e-46) {
tmp = x;
} else {
tmp = t * (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= 9e-46: tmp = x else: tmp = t * (x * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= 9e-46) tmp = x; else tmp = Float64(t * Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= 9e-46) tmp = x; else tmp = t * (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, 9e-46], x, N[(t * N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9 \cdot 10^{-46}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(x \cdot y\right)\\
\end{array}
\end{array}
if b < 9.00000000000000001e-46Initial program 94.1%
Taylor expanded in b around inf 54.6%
mul-1-neg54.6%
distribute-rgt-neg-out54.6%
Simplified54.6%
Taylor expanded in a around 0 22.0%
if 9.00000000000000001e-46 < b Initial program 100.0%
Taylor expanded in t around inf 49.3%
mul-1-neg49.3%
distribute-lft-neg-out49.3%
*-commutative49.3%
Simplified49.3%
Taylor expanded in y around 0 14.5%
mul-1-neg14.5%
*-commutative14.5%
unsub-neg14.5%
*-commutative14.5%
Simplified14.5%
Taylor expanded in t around inf 17.1%
mul-1-neg17.1%
distribute-rgt-neg-in17.1%
*-commutative17.1%
distribute-lft-neg-in17.1%
associate-*l*14.4%
*-commutative14.4%
Simplified14.4%
pow114.4%
add-sqr-sqrt7.8%
sqrt-unprod16.8%
sqr-neg16.8%
sqrt-unprod3.9%
add-sqr-sqrt10.5%
Applied egg-rr10.5%
unpow110.5%
associate-*r*12.1%
*-commutative12.1%
associate-*r*15.7%
Simplified15.7%
(FPCore (x y z t a b) :precision binary64 (* y (/ x y)))
double code(double x, double y, double z, double t, double a, double b) {
return y * (x / y);
}
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 = y * (x / y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return y * (x / y);
}
def code(x, y, z, t, a, b): return y * (x / y)
function code(x, y, z, t, a, b) return Float64(y * Float64(x / y)) end
function tmp = code(x, y, z, t, a, b) tmp = y * (x / y); end
code[x_, y_, z_, t_, a_, b_] := N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{x}{y}
\end{array}
Initial program 95.8%
Taylor expanded in t around inf 56.0%
mul-1-neg56.0%
distribute-lft-neg-out56.0%
*-commutative56.0%
Simplified56.0%
Taylor expanded in y around 0 26.3%
mul-1-neg26.3%
*-commutative26.3%
unsub-neg26.3%
*-commutative26.3%
Simplified26.3%
Taylor expanded in y around inf 23.9%
+-commutative23.9%
mul-1-neg23.9%
sub-neg23.9%
*-commutative23.9%
Simplified23.9%
Taylor expanded in y around 0 24.1%
(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.8%
Taylor expanded in b around inf 58.5%
mul-1-neg58.5%
distribute-rgt-neg-out58.5%
Simplified58.5%
Taylor expanded in a around 0 18.6%
herbie shell --seed 2024110
(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))))))