
(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 11 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.3%
fma-define97.7%
sub-neg97.7%
log1p-define99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
Initial program 97.3%
Final simplification97.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.2) (not (<= y 1.4e+29))) (* x (exp (* y (- (log z) t)))) (* x (exp (* a (- (- b) z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.2) || !(y <= 1.4e+29)) {
tmp = x * exp((y * (log(z) - t)));
} else {
tmp = x * exp((a * (-b - z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-2.2d0)) .or. (.not. (y <= 1.4d+29))) then
tmp = x * exp((y * (log(z) - t)))
else
tmp = x * exp((a * (-b - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.2) || !(y <= 1.4e+29)) {
tmp = x * Math.exp((y * (Math.log(z) - t)));
} else {
tmp = x * Math.exp((a * (-b - z)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.2) or not (y <= 1.4e+29): tmp = x * math.exp((y * (math.log(z) - t))) else: tmp = x * math.exp((a * (-b - z))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.2) || !(y <= 1.4e+29)) tmp = Float64(x * exp(Float64(y * Float64(log(z) - t)))); else tmp = Float64(x * exp(Float64(a * Float64(Float64(-b) - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -2.2) || ~((y <= 1.4e+29))) tmp = x * exp((y * (log(z) - t))); else tmp = x * exp((a * (-b - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.2], N[Not[LessEqual[y, 1.4e+29]], $MachinePrecision]], N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * N[((-b) - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \lor \neg \left(y \leq 1.4 \cdot 10^{+29}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-b\right) - z\right)}\\
\end{array}
\end{array}
if y < -2.2000000000000002 or 1.4e29 < y Initial program 97.4%
Taylor expanded in y around inf 88.0%
if -2.2000000000000002 < y < 1.4e29Initial program 97.2%
Taylor expanded in y around 0 90.1%
sub-neg90.1%
mul-1-neg90.1%
log1p-define92.9%
mul-1-neg92.9%
Simplified92.9%
Taylor expanded in z around 0 92.9%
associate-*r*92.9%
associate-*r*92.9%
distribute-lft-out92.9%
neg-mul-192.9%
Simplified92.9%
Final simplification90.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -3600000000.0) (not (<= y 2.3e-8))) (* x (pow z y)) (* x (exp (* a (- (- b) z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -3600000000.0) || !(y <= 2.3e-8)) {
tmp = x * pow(z, y);
} else {
tmp = x * exp((a * (-b - z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-3600000000.0d0)) .or. (.not. (y <= 2.3d-8))) then
tmp = x * (z ** y)
else
tmp = x * exp((a * (-b - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -3600000000.0) || !(y <= 2.3e-8)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x * Math.exp((a * (-b - z)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -3600000000.0) or not (y <= 2.3e-8): tmp = x * math.pow(z, y) else: tmp = x * math.exp((a * (-b - z))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -3600000000.0) || !(y <= 2.3e-8)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * exp(Float64(a * Float64(Float64(-b) - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -3600000000.0) || ~((y <= 2.3e-8))) tmp = x * (z ^ y); else tmp = x * exp((a * (-b - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -3600000000.0], N[Not[LessEqual[y, 2.3e-8]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * N[((-b) - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3600000000 \lor \neg \left(y \leq 2.3 \cdot 10^{-8}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-b\right) - z\right)}\\
\end{array}
\end{array}
if y < -3.6e9 or 2.3000000000000001e-8 < y Initial program 97.5%
Taylor expanded in y around inf 86.7%
Taylor expanded in t around 0 72.5%
if -3.6e9 < y < 2.3000000000000001e-8Initial program 97.2%
Taylor expanded in y around 0 90.3%
sub-neg90.3%
mul-1-neg90.3%
log1p-define93.2%
mul-1-neg93.2%
Simplified93.2%
Taylor expanded in z around 0 93.2%
associate-*r*93.2%
associate-*r*93.2%
distribute-lft-out93.2%
neg-mul-193.2%
Simplified93.2%
Final simplification83.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -8.2e+65) (not (<= t 1e+108))) (* x (exp (* t (- y)))) (* x (pow z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -8.2e+65) || !(t <= 1e+108)) {
tmp = x * exp((t * -y));
} else {
tmp = x * pow(z, y);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((t <= (-8.2d+65)) .or. (.not. (t <= 1d+108))) then
tmp = x * exp((t * -y))
else
tmp = x * (z ** y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -8.2e+65) || !(t <= 1e+108)) {
tmp = x * Math.exp((t * -y));
} else {
tmp = x * Math.pow(z, y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -8.2e+65) or not (t <= 1e+108): tmp = x * math.exp((t * -y)) else: tmp = x * math.pow(z, y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -8.2e+65) || !(t <= 1e+108)) tmp = Float64(x * exp(Float64(t * Float64(-y)))); else tmp = Float64(x * (z ^ y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -8.2e+65) || ~((t <= 1e+108))) tmp = x * exp((t * -y)); else tmp = x * (z ^ y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -8.2e+65], N[Not[LessEqual[t, 1e+108]], $MachinePrecision]], N[(x * N[Exp[N[(t * (-y)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{+65} \lor \neg \left(t \leq 10^{+108}\right):\\
\;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\end{array}
if t < -8.2000000000000003e65 or 1e108 < t Initial program 96.4%
Taylor expanded in t around inf 78.3%
mul-1-neg78.3%
*-commutative78.3%
Simplified78.3%
if -8.2000000000000003e65 < t < 1e108Initial program 97.7%
Taylor expanded in y around inf 63.1%
Taylor expanded in t around 0 63.1%
Final simplification68.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.2) (not (<= y 2.3e-8))) (* 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 <= -4.2) || !(y <= 2.3e-8)) {
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 <= (-4.2d0)) .or. (.not. (y <= 2.3d-8))) 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 <= -4.2) || !(y <= 2.3e-8)) {
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 <= -4.2) or not (y <= 2.3e-8): 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 <= -4.2) || !(y <= 2.3e-8)) 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 <= -4.2) || ~((y <= 2.3e-8))) 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, -4.2], N[Not[LessEqual[y, 2.3e-8]], $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 -4.2 \lor \neg \left(y \leq 2.3 \cdot 10^{-8}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\end{array}
\end{array}
if y < -4.20000000000000018 or 2.3000000000000001e-8 < y Initial program 97.5%
Taylor expanded in y around inf 86.7%
Taylor expanded in t around 0 72.5%
if -4.20000000000000018 < y < 2.3000000000000001e-8Initial program 97.2%
Taylor expanded in b around inf 88.2%
mul-1-neg88.2%
distribute-rgt-neg-out88.2%
Simplified88.2%
Final simplification81.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -9.5e-126) (not (<= y 1.2e-14))) (* 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 <= -9.5e-126) || !(y <= 1.2e-14)) {
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 <= (-9.5d-126)) .or. (.not. (y <= 1.2d-14))) 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 <= -9.5e-126) || !(y <= 1.2e-14)) {
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 <= -9.5e-126) or not (y <= 1.2e-14): 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 <= -9.5e-126) || !(y <= 1.2e-14)) 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 <= -9.5e-126) || ~((y <= 1.2e-14))) 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, -9.5e-126], N[Not[LessEqual[y, 1.2e-14]], $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 -9.5 \cdot 10^{-126} \lor \neg \left(y \leq 1.2 \cdot 10^{-14}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\end{array}
\end{array}
if y < -9.5000000000000003e-126 or 1.2e-14 < y Initial program 97.2%
Taylor expanded in y around inf 81.3%
Taylor expanded in t around 0 64.8%
if -9.5000000000000003e-126 < y < 1.2e-14Initial program 97.4%
Taylor expanded in b around inf 92.6%
mul-1-neg92.6%
distribute-rgt-neg-out92.6%
Simplified92.6%
Taylor expanded in a around 0 51.0%
mul-1-neg51.0%
unsub-neg51.0%
Simplified51.0%
Taylor expanded in x around 0 55.1%
Final simplification60.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (* x (* z a)))))
(if (<= y -2.4e+70)
t_1
(if (<= y 3e-8)
x
(if (<= y 6.5e+171)
(* (- a) (* x z))
(if (<= y 6.1e+286) (* x (* a (- b))) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -(x * (z * a));
double tmp;
if (y <= -2.4e+70) {
tmp = t_1;
} else if (y <= 3e-8) {
tmp = x;
} else if (y <= 6.5e+171) {
tmp = -a * (x * z);
} else if (y <= 6.1e+286) {
tmp = x * (a * -b);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = -(x * (z * a))
if (y <= (-2.4d+70)) then
tmp = t_1
else if (y <= 3d-8) then
tmp = x
else if (y <= 6.5d+171) then
tmp = -a * (x * z)
else if (y <= 6.1d+286) then
tmp = x * (a * -b)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -(x * (z * a));
double tmp;
if (y <= -2.4e+70) {
tmp = t_1;
} else if (y <= 3e-8) {
tmp = x;
} else if (y <= 6.5e+171) {
tmp = -a * (x * z);
} else if (y <= 6.1e+286) {
tmp = x * (a * -b);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -(x * (z * a)) tmp = 0 if y <= -2.4e+70: tmp = t_1 elif y <= 3e-8: tmp = x elif y <= 6.5e+171: tmp = -a * (x * z) elif y <= 6.1e+286: tmp = x * (a * -b) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(-Float64(x * Float64(z * a))) tmp = 0.0 if (y <= -2.4e+70) tmp = t_1; elseif (y <= 3e-8) tmp = x; elseif (y <= 6.5e+171) tmp = Float64(Float64(-a) * Float64(x * z)); elseif (y <= 6.1e+286) tmp = Float64(x * Float64(a * Float64(-b))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -(x * (z * a)); tmp = 0.0; if (y <= -2.4e+70) tmp = t_1; elseif (y <= 3e-8) tmp = x; elseif (y <= 6.5e+171) tmp = -a * (x * z); elseif (y <= 6.1e+286) tmp = x * (a * -b); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = (-N[(x * N[(z * a), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[y, -2.4e+70], t$95$1, If[LessEqual[y, 3e-8], x, If[LessEqual[y, 6.5e+171], N[((-a) * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.1e+286], N[(x * N[(a * (-b)), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -x \cdot \left(z \cdot a\right)\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-8}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+171}:\\
\;\;\;\;\left(-a\right) \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;y \leq 6.1 \cdot 10^{+286}:\\
\;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.39999999999999987e70 or 6.1000000000000002e286 < y Initial program 100.0%
Taylor expanded in y around 0 34.5%
sub-neg34.5%
mul-1-neg34.5%
log1p-define38.0%
mul-1-neg38.0%
Simplified38.0%
Taylor expanded in b around 0 6.9%
Taylor expanded in z around 0 4.9%
+-commutative4.9%
mul-1-neg4.9%
Simplified4.9%
Taylor expanded in a around inf 14.8%
mul-1-neg14.8%
*-commutative14.8%
associate-*r*18.3%
distribute-rgt-neg-in18.3%
distribute-rgt-neg-in18.3%
Simplified18.3%
if -2.39999999999999987e70 < y < 2.99999999999999973e-8Initial program 97.4%
Taylor expanded in y around 0 86.8%
sub-neg86.8%
mul-1-neg86.8%
log1p-define89.4%
mul-1-neg89.4%
Simplified89.4%
Taylor expanded in a around 0 37.4%
if 2.99999999999999973e-8 < y < 6.5e171Initial program 93.2%
Taylor expanded in y around 0 39.9%
sub-neg39.9%
mul-1-neg39.9%
log1p-define43.2%
mul-1-neg43.2%
Simplified43.2%
Taylor expanded in b around 0 4.8%
Taylor expanded in z around 0 7.4%
+-commutative7.4%
mul-1-neg7.4%
Simplified7.4%
Taylor expanded in a around inf 43.1%
if 6.5e171 < y < 6.1000000000000002e286Initial program 95.7%
Taylor expanded in b around inf 37.2%
mul-1-neg37.2%
distribute-rgt-neg-out37.2%
Simplified37.2%
Taylor expanded in a around 0 16.1%
mul-1-neg16.1%
unsub-neg16.1%
Simplified16.1%
Taylor expanded in a around inf 41.5%
mul-1-neg41.5%
*-commutative41.5%
associate-*l*45.6%
distribute-lft-neg-in45.6%
Simplified45.6%
Taylor expanded in a around 0 41.5%
mul-1-neg41.5%
associate-*r*49.5%
*-commutative49.5%
distribute-lft-neg-in49.5%
Simplified49.5%
Final simplification35.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.4e+70) (not (<= y 7.1e-6))) (- (* x (* z a))) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.4e+70) || !(y <= 7.1e-6)) {
tmp = -(x * (z * 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.4d+70)) .or. (.not. (y <= 7.1d-6))) then
tmp = -(x * (z * 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.4e+70) || !(y <= 7.1e-6)) {
tmp = -(x * (z * a));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.4e+70) or not (y <= 7.1e-6): tmp = -(x * (z * a)) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.4e+70) || !(y <= 7.1e-6)) tmp = Float64(-Float64(x * Float64(z * a))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -2.4e+70) || ~((y <= 7.1e-6))) tmp = -(x * (z * a)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.4e+70], N[Not[LessEqual[y, 7.1e-6]], $MachinePrecision]], (-N[(x * N[(z * a), $MachinePrecision]), $MachinePrecision]), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+70} \lor \neg \left(y \leq 7.1 \cdot 10^{-6}\right):\\
\;\;\;\;-x \cdot \left(z \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.39999999999999987e70 or 7.0999999999999998e-6 < y Initial program 97.2%
Taylor expanded in y around 0 36.6%
sub-neg36.6%
mul-1-neg36.6%
log1p-define40.2%
mul-1-neg40.2%
Simplified40.2%
Taylor expanded in b around 0 5.7%
Taylor expanded in z around 0 5.3%
+-commutative5.3%
mul-1-neg5.3%
Simplified5.3%
Taylor expanded in a around inf 25.4%
mul-1-neg25.4%
*-commutative25.4%
associate-*r*26.0%
distribute-rgt-neg-in26.0%
distribute-rgt-neg-in26.0%
Simplified26.0%
if -2.39999999999999987e70 < y < 7.0999999999999998e-6Initial program 97.4%
Taylor expanded in y around 0 86.8%
sub-neg86.8%
mul-1-neg86.8%
log1p-define89.4%
mul-1-neg89.4%
Simplified89.4%
Taylor expanded in a around 0 37.4%
Final simplification32.6%
(FPCore (x y z t a b) :precision binary64 (if (<= x 1.46e-182) (* (- 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 <= 1.46e-182) {
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 <= 1.46d-182) 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 <= 1.46e-182) {
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 <= 1.46e-182: 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 <= 1.46e-182) tmp = Float64(Float64(-a) * Float64(x * 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 <= 1.46e-182) 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, 1.46e-182], 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 1.46 \cdot 10^{-182}:\\
\;\;\;\;\left(-a\right) \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\end{array}
\end{array}
if x < 1.46e-182Initial program 98.8%
Taylor expanded in y around 0 65.9%
sub-neg65.9%
mul-1-neg65.9%
log1p-define67.1%
mul-1-neg67.1%
Simplified67.1%
Taylor expanded in b around 0 27.0%
Taylor expanded in z around 0 25.5%
+-commutative25.5%
mul-1-neg25.5%
Simplified25.5%
Taylor expanded in a around inf 22.7%
if 1.46e-182 < x Initial program 94.7%
Taylor expanded in b around inf 64.5%
mul-1-neg64.5%
distribute-rgt-neg-out64.5%
Simplified64.5%
Taylor expanded in a around 0 29.1%
mul-1-neg29.1%
unsub-neg29.1%
Simplified29.1%
Taylor expanded in x around 0 29.1%
Final simplification25.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 97.3%
Taylor expanded in y around 0 65.8%
sub-neg65.8%
mul-1-neg65.8%
log1p-define68.8%
mul-1-neg68.8%
Simplified68.8%
Taylor expanded in a around 0 23.4%
Final simplification23.4%
herbie shell --seed 2024044
(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))))))