
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
(FPCore (x y z t a b) :precision binary64 (* x (exp (fma y (- (log z) t) (* a (- (log1p (- z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(fma(y, (log(z) - t), (a * (log1p(-z) - b))));
}
function code(x, y, z, t, a, b) return Float64(x * exp(fma(y, Float64(log(z) - t), Float64(a * Float64(log1p(Float64(-z)) - b))))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}
\end{array}
Initial program 95.9%
fma-def96.3%
sub-neg96.3%
log1p-def100.0%
Simplified100.0%
Final simplification100.0%
(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.9%
Final simplification95.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -3.8e+14) (not (<= y 1.3e-50))) (* 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 <= -3.8e+14) || !(y <= 1.3e-50)) {
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 <= (-3.8d+14)) .or. (.not. (y <= 1.3d-50))) 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 <= -3.8e+14) || !(y <= 1.3e-50)) {
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 <= -3.8e+14) or not (y <= 1.3e-50): 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 <= -3.8e+14) || !(y <= 1.3e-50)) tmp = Float64(x * exp(Float64(y * Float64(log(z) - t)))); else tmp = Float64(x * exp(Float64(a * Float64(-Float64(z + b))))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -3.8e+14) || ~((y <= 1.3e-50))) 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, -3.8e+14], N[Not[LessEqual[y, 1.3e-50]], $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 -3.8 \cdot 10^{+14} \lor \neg \left(y \leq 1.3 \cdot 10^{-50}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-\left(z + b\right)\right)}\\
\end{array}
\end{array}
if y < -3.8e14 or 1.3000000000000001e-50 < y Initial program 99.3%
Taylor expanded in y around inf 85.5%
if -3.8e14 < y < 1.3000000000000001e-50Initial program 92.1%
Taylor expanded in y around 0 84.2%
sub-neg84.2%
neg-mul-184.2%
log1p-def92.8%
neg-mul-192.8%
sub-neg92.8%
+-commutative92.8%
+-commutative92.8%
sub-neg92.8%
Simplified92.8%
Taylor expanded in z around 0 92.8%
neg-mul-192.8%
unsub-neg92.8%
neg-mul-192.8%
Simplified92.8%
Final simplification88.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -8.8e+15) (not (<= y 1250000000.0))) (* x (pow z y)) (* x (exp (* a (- (+ z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -8.8e+15) || !(y <= 1250000000.0)) {
tmp = x * pow(z, y);
} 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 <= (-8.8d+15)) .or. (.not. (y <= 1250000000.0d0))) then
tmp = x * (z ** y)
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 <= -8.8e+15) || !(y <= 1250000000.0)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x * Math.exp((a * -(z + b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -8.8e+15) or not (y <= 1250000000.0): tmp = x * math.pow(z, y) else: tmp = x * math.exp((a * -(z + b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -8.8e+15) || !(y <= 1250000000.0)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * exp(Float64(a * Float64(-Float64(z + b))))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -8.8e+15) || ~((y <= 1250000000.0))) tmp = x * (z ^ y); else tmp = x * exp((a * -(z + b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -8.8e+15], N[Not[LessEqual[y, 1250000000.0]], $MachinePrecision]], N[(x * N[Power[z, y], $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 -8.8 \cdot 10^{+15} \lor \neg \left(y \leq 1250000000\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-\left(z + b\right)\right)}\\
\end{array}
\end{array}
if y < -8.8e15 or 1.25e9 < y Initial program 99.2%
Taylor expanded in y around inf 85.7%
Taylor expanded in t around 0 72.2%
if -8.8e15 < y < 1.25e9Initial program 92.9%
Taylor expanded in y around 0 82.5%
sub-neg82.5%
neg-mul-182.5%
log1p-def90.3%
neg-mul-190.3%
sub-neg90.3%
+-commutative90.3%
+-commutative90.3%
sub-neg90.3%
Simplified90.3%
Taylor expanded in z around 0 90.3%
neg-mul-190.3%
unsub-neg90.3%
neg-mul-190.3%
Simplified90.3%
Final simplification81.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -3.2e+14) (not (<= y 12000000.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.2e+14) || !(y <= 12000000.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.2d+14)) .or. (.not. (y <= 12000000.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.2e+14) || !(y <= 12000000.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.2e+14) or not (y <= 12000000.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.2e+14) || !(y <= 12000000.0)) 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 <= -3.2e+14) || ~((y <= 12000000.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.2e+14], N[Not[LessEqual[y, 12000000.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.2 \cdot 10^{+14} \lor \neg \left(y \leq 12000000\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{-a \cdot b}\\
\end{array}
\end{array}
if y < -3.2e14 or 1.2e7 < y Initial program 99.2%
Taylor expanded in y around inf 85.7%
Taylor expanded in t around 0 72.2%
if -3.2e14 < y < 1.2e7Initial program 92.9%
Taylor expanded in b around inf 81.7%
associate-*r*81.7%
*-commutative81.7%
neg-mul-181.7%
Simplified81.7%
Final simplification77.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -3.2e+14) (not (<= y 4100000.0))) (* x (pow z y)) (* x (+ 1.0 (- (* 0.5 (* (* a b) (* a b))) (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -3.2e+14) || !(y <= 4100000.0)) {
tmp = x * pow(z, y);
} else {
tmp = x * (1.0 + ((0.5 * ((a * b) * (a * b))) - (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.2d+14)) .or. (.not. (y <= 4100000.0d0))) then
tmp = x * (z ** y)
else
tmp = x * (1.0d0 + ((0.5d0 * ((a * b) * (a * b))) - (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.2e+14) || !(y <= 4100000.0)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x * (1.0 + ((0.5 * ((a * b) * (a * b))) - (a * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -3.2e+14) or not (y <= 4100000.0): tmp = x * math.pow(z, y) else: tmp = x * (1.0 + ((0.5 * ((a * b) * (a * b))) - (a * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -3.2e+14) || !(y <= 4100000.0)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * Float64(1.0 + Float64(Float64(0.5 * Float64(Float64(a * b) * Float64(a * b))) - Float64(a * b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -3.2e+14) || ~((y <= 4100000.0))) tmp = x * (z ^ y); else tmp = x * (1.0 + ((0.5 * ((a * b) * (a * b))) - (a * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -3.2e+14], N[Not[LessEqual[y, 4100000.0]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(N[(0.5 * N[(N[(a * b), $MachinePrecision] * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+14} \lor \neg \left(y \leq 4100000\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \left(0.5 \cdot \left(\left(a \cdot b\right) \cdot \left(a \cdot b\right)\right) - a \cdot b\right)\right)\\
\end{array}
\end{array}
if y < -3.2e14 or 4.1e6 < y Initial program 99.2%
Taylor expanded in y around inf 85.7%
Taylor expanded in t around 0 72.2%
if -3.2e14 < y < 4.1e6Initial program 92.9%
fma-def92.9%
sub-neg92.9%
log1p-def100.0%
Simplified100.0%
*-un-lft-identity100.0%
exp-prod100.0%
exp-1-e100.0%
add-sqr-sqrt0.0%
sqrt-unprod88.3%
sqr-neg88.3%
sqrt-unprod88.3%
add-sqr-sqrt88.3%
Applied egg-rr88.3%
Taylor expanded in b around inf 81.8%
mul-1-neg81.8%
*-commutative81.8%
distribute-rgt-neg-in81.8%
Simplified81.8%
Taylor expanded in b around 0 54.6%
+-commutative54.6%
mul-1-neg54.6%
unsub-neg54.6%
associate-*r*54.6%
log-E54.6%
metadata-eval54.6%
*-rgt-identity54.6%
unpow254.6%
unpow254.6%
unswap-sqr56.9%
log-E56.9%
*-rgt-identity56.9%
Simplified56.9%
Final simplification64.3%
(FPCore (x y z t a b) :precision binary64 (* x (+ 1.0 (- (* 0.5 (* (* a b) (* a b))) (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
return x * (1.0 + ((0.5 * ((a * b) * (a * b))) - (a * b)));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * (1.0d0 + ((0.5d0 * ((a * b) * (a * b))) - (a * b)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * (1.0 + ((0.5 * ((a * b) * (a * b))) - (a * b)));
}
def code(x, y, z, t, a, b): return x * (1.0 + ((0.5 * ((a * b) * (a * b))) - (a * b)))
function code(x, y, z, t, a, b) return Float64(x * Float64(1.0 + Float64(Float64(0.5 * Float64(Float64(a * b) * Float64(a * b))) - Float64(a * b)))) end
function tmp = code(x, y, z, t, a, b) tmp = x * (1.0 + ((0.5 * ((a * b) * (a * b))) - (a * b))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[(1.0 + N[(N[(0.5 * N[(N[(a * b), $MachinePrecision] * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 + \left(0.5 \cdot \left(\left(a \cdot b\right) \cdot \left(a \cdot b\right)\right) - a \cdot b\right)\right)
\end{array}
Initial program 95.9%
fma-def96.3%
sub-neg96.3%
log1p-def100.0%
Simplified100.0%
*-un-lft-identity100.0%
exp-prod100.0%
exp-1-e100.0%
add-sqr-sqrt0.0%
sqrt-unprod94.0%
sqr-neg94.0%
sqrt-unprod94.0%
add-sqr-sqrt94.0%
Applied egg-rr94.0%
Taylor expanded in b around inf 62.5%
mul-1-neg62.5%
*-commutative62.5%
distribute-rgt-neg-in62.5%
Simplified62.5%
Taylor expanded in b around 0 40.4%
+-commutative40.4%
mul-1-neg40.4%
unsub-neg40.4%
associate-*r*40.4%
log-E40.4%
metadata-eval40.4%
*-rgt-identity40.4%
unpow240.4%
unpow240.4%
unswap-sqr40.7%
log-E40.7%
*-rgt-identity40.7%
Simplified40.7%
Final simplification40.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -1.6e-185) (not (<= x 1.2e-152))) (* x (- 1.0 (* a b))) (* a (- (* x z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -1.6e-185) || !(x <= 1.2e-152)) {
tmp = x * (1.0 - (a * b));
} else {
tmp = a * -(x * z);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((x <= (-1.6d-185)) .or. (.not. (x <= 1.2d-152))) then
tmp = x * (1.0d0 - (a * b))
else
tmp = a * -(x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -1.6e-185) || !(x <= 1.2e-152)) {
tmp = x * (1.0 - (a * b));
} else {
tmp = a * -(x * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x <= -1.6e-185) or not (x <= 1.2e-152): tmp = x * (1.0 - (a * b)) else: tmp = a * -(x * z) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -1.6e-185) || !(x <= 1.2e-152)) tmp = Float64(x * Float64(1.0 - Float64(a * b))); else tmp = Float64(a * Float64(-Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x <= -1.6e-185) || ~((x <= 1.2e-152))) tmp = x * (1.0 - (a * b)); else tmp = a * -(x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -1.6e-185], N[Not[LessEqual[x, 1.2e-152]], $MachinePrecision]], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * (-N[(x * z), $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-185} \lor \neg \left(x \leq 1.2 \cdot 10^{-152}\right):\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(-x \cdot z\right)\\
\end{array}
\end{array}
if x < -1.5999999999999999e-185 or 1.2e-152 < x Initial program 95.4%
Taylor expanded in b around inf 64.5%
associate-*r*64.5%
*-commutative64.5%
neg-mul-164.5%
Simplified64.5%
Taylor expanded in b around 0 33.4%
mul-1-neg33.4%
unsub-neg33.4%
*-commutative33.4%
Simplified33.4%
if -1.5999999999999999e-185 < x < 1.2e-152Initial program 98.0%
Taylor expanded in y around 0 55.9%
sub-neg55.9%
neg-mul-155.9%
log1p-def59.8%
neg-mul-159.8%
sub-neg59.8%
+-commutative59.8%
+-commutative59.8%
sub-neg59.8%
Simplified59.8%
Taylor expanded in b around 0 13.6%
Taylor expanded in z around 0 11.4%
mul-1-neg11.4%
unsub-neg11.4%
Simplified11.4%
Taylor expanded in a around inf 40.3%
mul-1-neg40.3%
*-commutative40.3%
distribute-rgt-neg-in40.3%
*-commutative40.3%
distribute-rgt-neg-in40.3%
Simplified40.3%
Final simplification34.7%
(FPCore (x y z t a b) :precision binary64 (if (<= x -6.2e-183) (* x (- 1.0 (* a b))) (if (<= x 2.95e-106) (* a (- (* x z))) (- x (* a (* x b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -6.2e-183) {
tmp = x * (1.0 - (a * b));
} else if (x <= 2.95e-106) {
tmp = a * -(x * z);
} else {
tmp = x - (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 (x <= (-6.2d-183)) then
tmp = x * (1.0d0 - (a * b))
else if (x <= 2.95d-106) then
tmp = a * -(x * z)
else
tmp = x - (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 (x <= -6.2e-183) {
tmp = x * (1.0 - (a * b));
} else if (x <= 2.95e-106) {
tmp = a * -(x * z);
} else {
tmp = x - (a * (x * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -6.2e-183: tmp = x * (1.0 - (a * b)) elif x <= 2.95e-106: tmp = a * -(x * z) else: tmp = x - (a * (x * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -6.2e-183) tmp = Float64(x * Float64(1.0 - Float64(a * b))); elseif (x <= 2.95e-106) tmp = Float64(a * Float64(-Float64(x * z))); else tmp = Float64(x - Float64(a * Float64(x * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -6.2e-183) tmp = x * (1.0 - (a * b)); elseif (x <= 2.95e-106) tmp = a * -(x * z); else tmp = x - (a * (x * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -6.2e-183], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.95e-106], N[(a * (-N[(x * z), $MachinePrecision])), $MachinePrecision], N[(x - N[(a * N[(x * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-183}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\mathbf{elif}\;x \leq 2.95 \cdot 10^{-106}:\\
\;\;\;\;a \cdot \left(-x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \left(x \cdot b\right)\\
\end{array}
\end{array}
if x < -6.19999999999999999e-183Initial program 94.1%
Taylor expanded in b around inf 69.3%
associate-*r*69.3%
*-commutative69.3%
neg-mul-169.3%
Simplified69.3%
Taylor expanded in b around 0 37.0%
mul-1-neg37.0%
unsub-neg37.0%
*-commutative37.0%
Simplified37.0%
if -6.19999999999999999e-183 < x < 2.9499999999999999e-106Initial program 98.3%
Taylor expanded in y around 0 53.5%
sub-neg53.5%
neg-mul-153.5%
log1p-def56.9%
neg-mul-156.9%
sub-neg56.9%
+-commutative56.9%
+-commutative56.9%
sub-neg56.9%
Simplified56.9%
Taylor expanded in b around 0 12.1%
Taylor expanded in z around 0 10.2%
mul-1-neg10.2%
unsub-neg10.2%
Simplified10.2%
Taylor expanded in a around inf 36.6%
mul-1-neg36.6%
*-commutative36.6%
distribute-rgt-neg-in36.6%
*-commutative36.6%
distribute-rgt-neg-in36.6%
Simplified36.6%
if 2.9499999999999999e-106 < x Initial program 96.6%
Taylor expanded in b around inf 60.9%
associate-*r*60.9%
*-commutative60.9%
neg-mul-160.9%
Simplified60.9%
Taylor expanded in b around 0 32.8%
+-commutative32.8%
mul-1-neg32.8%
unsub-neg32.8%
Simplified32.8%
Final simplification35.4%
(FPCore (x y z t a b) :precision binary64 (if (<= b -6.2e+28) (* a (* x (- b))) (if (<= b 6.4e+52) x (* a (- (* x z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -6.2e+28) {
tmp = a * (x * -b);
} else if (b <= 6.4e+52) {
tmp = x;
} else {
tmp = a * -(x * z);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-6.2d+28)) then
tmp = a * (x * -b)
else if (b <= 6.4d+52) then
tmp = x
else
tmp = a * -(x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -6.2e+28) {
tmp = a * (x * -b);
} else if (b <= 6.4e+52) {
tmp = x;
} else {
tmp = a * -(x * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -6.2e+28: tmp = a * (x * -b) elif b <= 6.4e+52: tmp = x else: tmp = a * -(x * z) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -6.2e+28) tmp = Float64(a * Float64(x * Float64(-b))); elseif (b <= 6.4e+52) tmp = x; else tmp = Float64(a * Float64(-Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -6.2e+28) tmp = a * (x * -b); elseif (b <= 6.4e+52) tmp = x; else tmp = a * -(x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -6.2e+28], N[(a * N[(x * (-b)), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.4e+52], x, N[(a * (-N[(x * z), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.2 \cdot 10^{+28}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\
\mathbf{elif}\;b \leq 6.4 \cdot 10^{+52}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(-x \cdot z\right)\\
\end{array}
\end{array}
if b < -6.2000000000000001e28Initial program 98.2%
Taylor expanded in b around inf 85.9%
associate-*r*85.9%
*-commutative85.9%
neg-mul-185.9%
Simplified85.9%
Taylor expanded in b around 0 41.7%
mul-1-neg41.7%
unsub-neg41.7%
*-commutative41.7%
Simplified41.7%
Taylor expanded in b around inf 35.4%
mul-1-neg35.4%
distribute-rgt-neg-in35.4%
distribute-rgt-neg-in35.4%
Simplified35.4%
if -6.2000000000000001e28 < b < 6.4e52Initial program 93.7%
Taylor expanded in b around inf 48.5%
associate-*r*48.5%
*-commutative48.5%
neg-mul-148.5%
Simplified48.5%
Taylor expanded in b around 0 28.5%
if 6.4e52 < b Initial program 99.9%
Taylor expanded in y around 0 76.9%
sub-neg76.9%
neg-mul-176.9%
log1p-def76.9%
neg-mul-176.9%
sub-neg76.9%
+-commutative76.9%
+-commutative76.9%
sub-neg76.9%
Simplified76.9%
Taylor expanded in b around 0 11.6%
Taylor expanded in z around 0 9.7%
mul-1-neg9.7%
unsub-neg9.7%
Simplified9.7%
Taylor expanded in a around inf 23.5%
mul-1-neg23.5%
*-commutative23.5%
distribute-rgt-neg-in23.5%
*-commutative23.5%
distribute-rgt-neg-in23.5%
Simplified23.5%
Final simplification29.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -3.9e+132) (not (<= y 2.7e+59))) (* a (* x b)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -3.9e+132) || !(y <= 2.7e+59)) {
tmp = a * (x * b);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-3.9d+132)) .or. (.not. (y <= 2.7d+59))) then
tmp = a * (x * b)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -3.9e+132) || !(y <= 2.7e+59)) {
tmp = a * (x * b);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -3.9e+132) or not (y <= 2.7e+59): tmp = a * (x * b) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -3.9e+132) || !(y <= 2.7e+59)) tmp = Float64(a * Float64(x * b)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -3.9e+132) || ~((y <= 2.7e+59))) tmp = a * (x * b); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -3.9e+132], N[Not[LessEqual[y, 2.7e+59]], $MachinePrecision]], N[(a * N[(x * b), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{+132} \lor \neg \left(y \leq 2.7 \cdot 10^{+59}\right):\\
\;\;\;\;a \cdot \left(x \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.90000000000000001e132 or 2.7000000000000001e59 < y Initial program 98.7%
Taylor expanded in b around inf 46.3%
associate-*r*46.3%
*-commutative46.3%
neg-mul-146.3%
Simplified46.3%
Taylor expanded in b around 0 14.3%
mul-1-neg14.3%
unsub-neg14.3%
*-commutative14.3%
Simplified14.3%
Taylor expanded in b around inf 20.3%
mul-1-neg20.3%
distribute-rgt-neg-in20.3%
distribute-rgt-neg-in20.3%
Simplified20.3%
expm1-log1p-u16.9%
expm1-udef29.7%
associate-*r*32.2%
add-sqr-sqrt13.4%
*-commutative13.4%
sqrt-unprod25.8%
sqr-neg25.8%
sqrt-unprod13.7%
add-sqr-sqrt27.1%
associate-*r*27.1%
Applied egg-rr27.1%
expm1-def14.5%
expm1-log1p18.6%
associate-*r*17.4%
*-commutative17.4%
associate-*r*19.9%
Simplified19.9%
if -3.90000000000000001e132 < y < 2.7000000000000001e59Initial program 94.8%
Taylor expanded in b around inf 69.3%
associate-*r*69.3%
*-commutative69.3%
neg-mul-169.3%
Simplified69.3%
Taylor expanded in b around 0 26.9%
Final simplification24.8%
(FPCore (x y z t a b) :precision binary64 (if (<= b -2.1e+28) (* a (* x (- b))) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -2.1e+28) {
tmp = a * (x * -b);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-2.1d+28)) then
tmp = a * (x * -b)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -2.1e+28) {
tmp = a * (x * -b);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -2.1e+28: tmp = a * (x * -b) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -2.1e+28) tmp = Float64(a * Float64(x * Float64(-b))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -2.1e+28) tmp = a * (x * -b); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -2.1e+28], N[(a * N[(x * (-b)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.1 \cdot 10^{+28}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if b < -2.09999999999999989e28Initial program 98.2%
Taylor expanded in b around inf 85.9%
associate-*r*85.9%
*-commutative85.9%
neg-mul-185.9%
Simplified85.9%
Taylor expanded in b around 0 41.7%
mul-1-neg41.7%
unsub-neg41.7%
*-commutative41.7%
Simplified41.7%
Taylor expanded in b around inf 35.4%
mul-1-neg35.4%
distribute-rgt-neg-in35.4%
distribute-rgt-neg-in35.4%
Simplified35.4%
if -2.09999999999999989e28 < b Initial program 95.3%
Taylor expanded in b around inf 55.8%
associate-*r*55.8%
*-commutative55.8%
neg-mul-155.8%
Simplified55.8%
Taylor expanded in b around 0 23.6%
Final simplification26.3%
(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.9%
Taylor expanded in b around inf 62.5%
associate-*r*62.5%
*-commutative62.5%
neg-mul-162.5%
Simplified62.5%
Taylor expanded in b around 0 20.0%
Final simplification20.0%
herbie shell --seed 2023171
(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))))))