
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
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
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
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
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
(FPCore (x y z t a) :precision binary64 (+ (log (+ x y)) (- (log z) (fma (log t) (- 0.5 a) t))))
double code(double x, double y, double z, double t, double a) {
return log((x + y)) + (log(z) - fma(log(t), (0.5 - a), t));
}
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + Float64(log(z) - fma(log(t), Float64(0.5 - a), t))) end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * N[(0.5 - a), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, 0.5 - a, t\right)\right)
\end{array}
Initial program 99.6%
associate-+l-99.6%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
(FPCore (x y z t a) :precision binary64 (if (<= (log z) 517.2) (+ (log (* (+ x y) z)) (- (* (log t) (+ a -0.5)) t)) (- (+ (log z) (log (* y (pow t -0.5)))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (log(z) <= 517.2) {
tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t);
} else {
tmp = (log(z) + log((y * pow(t, -0.5)))) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if (log(z) <= 517.2d0) then
tmp = log(((x + y) * z)) + ((log(t) * (a + (-0.5d0))) - t)
else
tmp = (log(z) + log((y * (t ** (-0.5d0))))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (Math.log(z) <= 517.2) {
tmp = Math.log(((x + y) * z)) + ((Math.log(t) * (a + -0.5)) - t);
} else {
tmp = (Math.log(z) + Math.log((y * Math.pow(t, -0.5)))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.log(z) <= 517.2: tmp = math.log(((x + y) * z)) + ((math.log(t) * (a + -0.5)) - t) else: tmp = (math.log(z) + math.log((y * math.pow(t, -0.5)))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (log(z) <= 517.2) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(Float64(log(t) * Float64(a + -0.5)) - t)); else tmp = Float64(Float64(log(z) + log(Float64(y * (t ^ -0.5)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (log(z) <= 517.2) tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t); else tmp = (log(z) + log((y * (t ^ -0.5)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Log[z], $MachinePrecision], 517.2], N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] + N[Log[N[(y * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log z \leq 517.2:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \left(\log t \cdot \left(a + -0.5\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log z + \log \left(y \cdot {t}^{-0.5}\right)\right) - t\\
\end{array}
\end{array}
if (log.f64 z) < 517.20000000000005Initial program 99.5%
remove-double-neg99.5%
associate--l+99.5%
remove-double-neg99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
metadata-eval99.5%
sub-neg99.5%
associate-+r-99.5%
associate-+l-99.5%
+-commutative99.5%
sum-log86.9%
sub-neg86.9%
metadata-eval86.9%
*-commutative86.9%
Applied egg-rr86.9%
+-commutative86.9%
Simplified86.9%
if 517.20000000000005 < (log.f64 z) Initial program 99.8%
remove-double-neg99.8%
associate--l+99.8%
remove-double-neg99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in a around 0 66.8%
Taylor expanded in x around 0 34.6%
+-commutative34.6%
*-un-lft-identity34.6%
fma-define34.6%
add-log-exp34.6%
sum-log30.6%
*-commutative30.6%
exp-to-pow30.6%
Applied egg-rr30.6%
fma-undefine30.6%
*-lft-identity30.6%
Simplified30.6%
Final simplification77.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (log t) a)))
(if (<= (- a 0.5) -2e+21)
t_1
(if (<= (- a 0.5) 10.0)
(- (+ (log y) (+ (log z) (* (log t) -0.5))) t)
(if (<= (- a 0.5) 5e+128)
(+ (log (* y z)) (fma (log t) (+ a -0.5) (- t)))
t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * a;
double tmp;
if ((a - 0.5) <= -2e+21) {
tmp = t_1;
} else if ((a - 0.5) <= 10.0) {
tmp = (log(y) + (log(z) + (log(t) * -0.5))) - t;
} else if ((a - 0.5) <= 5e+128) {
tmp = log((y * z)) + fma(log(t), (a + -0.5), -t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(t) * a) tmp = 0.0 if (Float64(a - 0.5) <= -2e+21) tmp = t_1; elseif (Float64(a - 0.5) <= 10.0) tmp = Float64(Float64(log(y) + Float64(log(z) + Float64(log(t) * -0.5))) - t); elseif (Float64(a - 0.5) <= 5e+128) tmp = Float64(log(Float64(y * z)) + fma(log(t), Float64(a + -0.5), Float64(-t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[N[(a - 0.5), $MachinePrecision], -2e+21], t$95$1, If[LessEqual[N[(a - 0.5), $MachinePrecision], 10.0], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(a - 0.5), $MachinePrecision], 5e+128], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot a\\
\mathbf{if}\;a - 0.5 \leq -2 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a - 0.5 \leq 10:\\
\;\;\;\;\left(\log y + \left(\log z + \log t \cdot -0.5\right)\right) - t\\
\mathbf{elif}\;a - 0.5 \leq 5 \cdot 10^{+128}:\\
\;\;\;\;\log \left(y \cdot z\right) + \mathsf{fma}\left(\log t, a + -0.5, -t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 a #s(literal 1/2 binary64)) < -2e21 or 5e128 < (-.f64 a #s(literal 1/2 binary64)) Initial program 99.6%
expm1-log1p-u44.3%
expm1-undefine44.3%
Applied egg-rr44.3%
expm1-define44.3%
Simplified44.3%
*-un-lft-identity44.3%
+-commutative44.3%
sum-log33.3%
Applied egg-rr33.3%
*-lft-identity33.3%
+-commutative33.3%
Simplified33.3%
Taylor expanded in a around inf 83.2%
*-commutative83.2%
Simplified83.2%
if -2e21 < (-.f64 a #s(literal 1/2 binary64)) < 10Initial program 99.5%
remove-double-neg99.5%
associate--l+99.5%
remove-double-neg99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in a around 0 97.9%
Taylor expanded in x around 0 59.3%
+-commutative59.3%
Simplified59.3%
if 10 < (-.f64 a #s(literal 1/2 binary64)) < 5e128Initial program 99.5%
expm1-log1p-u55.3%
expm1-undefine55.3%
Applied egg-rr55.3%
expm1-define55.3%
Simplified55.3%
*-un-lft-identity55.3%
+-commutative55.3%
sum-log44.2%
Applied egg-rr44.2%
*-lft-identity44.2%
+-commutative44.2%
Simplified44.2%
Taylor expanded in x around 0 62.8%
associate--l+62.8%
sub-neg62.8%
metadata-eval62.8%
+-commutative62.8%
distribute-rgt-out62.8%
+-commutative62.8%
distribute-rgt-in62.8%
fma-neg63.0%
+-commutative63.0%
Simplified63.0%
Final simplification68.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (log t) a)))
(if (<= (- a 0.5) -2e+21)
t_1
(if (<= (- a 0.5) 10.0)
(- (+ (log y) (+ (log z) (* (log t) -0.5))) t)
(if (<= (- a 0.5) 5e+128)
(- (+ (* (log t) (- a 0.5)) (log (* y z))) t)
t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * a;
double tmp;
if ((a - 0.5) <= -2e+21) {
tmp = t_1;
} else if ((a - 0.5) <= 10.0) {
tmp = (log(y) + (log(z) + (log(t) * -0.5))) - t;
} else if ((a - 0.5) <= 5e+128) {
tmp = ((log(t) * (a - 0.5)) + log((y * z))) - t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: t_1
real(8) :: tmp
t_1 = log(t) * a
if ((a - 0.5d0) <= (-2d+21)) then
tmp = t_1
else if ((a - 0.5d0) <= 10.0d0) then
tmp = (log(y) + (log(z) + (log(t) * (-0.5d0)))) - t
else if ((a - 0.5d0) <= 5d+128) then
tmp = ((log(t) * (a - 0.5d0)) + log((y * z))) - 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 t_1 = Math.log(t) * a;
double tmp;
if ((a - 0.5) <= -2e+21) {
tmp = t_1;
} else if ((a - 0.5) <= 10.0) {
tmp = (Math.log(y) + (Math.log(z) + (Math.log(t) * -0.5))) - t;
} else if ((a - 0.5) <= 5e+128) {
tmp = ((Math.log(t) * (a - 0.5)) + Math.log((y * z))) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(t) * a tmp = 0 if (a - 0.5) <= -2e+21: tmp = t_1 elif (a - 0.5) <= 10.0: tmp = (math.log(y) + (math.log(z) + (math.log(t) * -0.5))) - t elif (a - 0.5) <= 5e+128: tmp = ((math.log(t) * (a - 0.5)) + math.log((y * z))) - t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(log(t) * a) tmp = 0.0 if (Float64(a - 0.5) <= -2e+21) tmp = t_1; elseif (Float64(a - 0.5) <= 10.0) tmp = Float64(Float64(log(y) + Float64(log(z) + Float64(log(t) * -0.5))) - t); elseif (Float64(a - 0.5) <= 5e+128) tmp = Float64(Float64(Float64(log(t) * Float64(a - 0.5)) + log(Float64(y * z))) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(t) * a; tmp = 0.0; if ((a - 0.5) <= -2e+21) tmp = t_1; elseif ((a - 0.5) <= 10.0) tmp = (log(y) + (log(z) + (log(t) * -0.5))) - t; elseif ((a - 0.5) <= 5e+128) tmp = ((log(t) * (a - 0.5)) + log((y * z))) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[N[(a - 0.5), $MachinePrecision], -2e+21], t$95$1, If[LessEqual[N[(a - 0.5), $MachinePrecision], 10.0], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(a - 0.5), $MachinePrecision], 5e+128], N[(N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot a\\
\mathbf{if}\;a - 0.5 \leq -2 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a - 0.5 \leq 10:\\
\;\;\;\;\left(\log y + \left(\log z + \log t \cdot -0.5\right)\right) - t\\
\mathbf{elif}\;a - 0.5 \leq 5 \cdot 10^{+128}:\\
\;\;\;\;\left(\log t \cdot \left(a - 0.5\right) + \log \left(y \cdot z\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 a #s(literal 1/2 binary64)) < -2e21 or 5e128 < (-.f64 a #s(literal 1/2 binary64)) Initial program 99.6%
expm1-log1p-u44.3%
expm1-undefine44.3%
Applied egg-rr44.3%
expm1-define44.3%
Simplified44.3%
*-un-lft-identity44.3%
+-commutative44.3%
sum-log33.3%
Applied egg-rr33.3%
*-lft-identity33.3%
+-commutative33.3%
Simplified33.3%
Taylor expanded in a around inf 83.2%
*-commutative83.2%
Simplified83.2%
if -2e21 < (-.f64 a #s(literal 1/2 binary64)) < 10Initial program 99.5%
remove-double-neg99.5%
associate--l+99.5%
remove-double-neg99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in a around 0 97.9%
Taylor expanded in x around 0 59.3%
+-commutative59.3%
Simplified59.3%
if 10 < (-.f64 a #s(literal 1/2 binary64)) < 5e128Initial program 99.5%
expm1-log1p-u55.3%
expm1-undefine55.3%
Applied egg-rr55.3%
expm1-define55.3%
Simplified55.3%
*-un-lft-identity55.3%
+-commutative55.3%
sum-log44.2%
Applied egg-rr44.2%
*-lft-identity44.2%
+-commutative44.2%
Simplified44.2%
Taylor expanded in x around 0 62.8%
Final simplification68.7%
(FPCore (x y z t a) :precision binary64 (+ (+ (log (+ x y)) (- (log z) t)) (* (log t) (+ a -0.5))))
double code(double x, double y, double z, double t, double a) {
return (log((x + y)) + (log(z) - t)) + (log(t) * (a + -0.5));
}
real(8) function code(x, y, z, t, a)
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
code = (log((x + y)) + (log(z) - t)) + (log(t) * (a + (-0.5d0)))
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log((x + y)) + (Math.log(z) - t)) + (Math.log(t) * (a + -0.5));
}
def code(x, y, z, t, a): return (math.log((x + y)) + (math.log(z) - t)) + (math.log(t) * (a + -0.5))
function code(x, y, z, t, a) return Float64(Float64(log(Float64(x + y)) + Float64(log(z) - t)) + Float64(log(t) * Float64(a + -0.5))) end
function tmp = code(x, y, z, t, a) tmp = (log((x + y)) + (log(z) - t)) + (log(t) * (a + -0.5)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \log t \cdot \left(a + -0.5\right)
\end{array}
Initial program 99.6%
remove-double-neg99.6%
associate--l+99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (- (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) t))
double code(double x, double y, double z, double t, double a) {
return (log(y) + (log(z) + (log(t) * (a - 0.5)))) - t;
}
real(8) function code(x, y, z, t, a)
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
code = (log(y) + (log(z) + (log(t) * (a - 0.5d0)))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(y) + (Math.log(z) + (Math.log(t) * (a - 0.5)))) - t;
}
def code(x, y, z, t, a): return (math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5)))) - t
function code(x, y, z, t, a) return Float64(Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(y) + (log(z) + (log(t) * (a - 0.5)))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t
\end{array}
Initial program 99.6%
remove-double-neg99.6%
associate--l+99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 67.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (log (* y (* z (pow t -0.5)))) t))
(t_2 (* (log t) a))
(t_3 (- (+ (log z) (log y)) t)))
(if (<= a -700000.0)
(+ (log (+ x y)) t_2)
(if (<= a -1.1e-267)
t_1
(if (<= a 3.9e-271)
t_3
(if (<= a 1.7e-47) t_1 (if (<= a 1.85e+50) t_3 t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((y * (z * pow(t, -0.5)))) - t;
double t_2 = log(t) * a;
double t_3 = (log(z) + log(y)) - t;
double tmp;
if (a <= -700000.0) {
tmp = log((x + y)) + t_2;
} else if (a <= -1.1e-267) {
tmp = t_1;
} else if (a <= 3.9e-271) {
tmp = t_3;
} else if (a <= 1.7e-47) {
tmp = t_1;
} else if (a <= 1.85e+50) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = log((y * (z * (t ** (-0.5d0))))) - t
t_2 = log(t) * a
t_3 = (log(z) + log(y)) - t
if (a <= (-700000.0d0)) then
tmp = log((x + y)) + t_2
else if (a <= (-1.1d-267)) then
tmp = t_1
else if (a <= 3.9d-271) then
tmp = t_3
else if (a <= 1.7d-47) then
tmp = t_1
else if (a <= 1.85d+50) then
tmp = t_3
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = Math.log((y * (z * Math.pow(t, -0.5)))) - t;
double t_2 = Math.log(t) * a;
double t_3 = (Math.log(z) + Math.log(y)) - t;
double tmp;
if (a <= -700000.0) {
tmp = Math.log((x + y)) + t_2;
} else if (a <= -1.1e-267) {
tmp = t_1;
} else if (a <= 3.9e-271) {
tmp = t_3;
} else if (a <= 1.7e-47) {
tmp = t_1;
} else if (a <= 1.85e+50) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((y * (z * math.pow(t, -0.5)))) - t t_2 = math.log(t) * a t_3 = (math.log(z) + math.log(y)) - t tmp = 0 if a <= -700000.0: tmp = math.log((x + y)) + t_2 elif a <= -1.1e-267: tmp = t_1 elif a <= 3.9e-271: tmp = t_3 elif a <= 1.7e-47: tmp = t_1 elif a <= 1.85e+50: tmp = t_3 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(log(Float64(y * Float64(z * (t ^ -0.5)))) - t) t_2 = Float64(log(t) * a) t_3 = Float64(Float64(log(z) + log(y)) - t) tmp = 0.0 if (a <= -700000.0) tmp = Float64(log(Float64(x + y)) + t_2); elseif (a <= -1.1e-267) tmp = t_1; elseif (a <= 3.9e-271) tmp = t_3; elseif (a <= 1.7e-47) tmp = t_1; elseif (a <= 1.85e+50) tmp = t_3; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((y * (z * (t ^ -0.5)))) - t; t_2 = log(t) * a; t_3 = (log(z) + log(y)) - t; tmp = 0.0; if (a <= -700000.0) tmp = log((x + y)) + t_2; elseif (a <= -1.1e-267) tmp = t_1; elseif (a <= 3.9e-271) tmp = t_3; elseif (a <= 1.7e-47) tmp = t_1; elseif (a <= 1.85e+50) tmp = t_3; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(y * N[(z * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[a, -700000.0], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + t$95$2), $MachinePrecision], If[LessEqual[a, -1.1e-267], t$95$1, If[LessEqual[a, 3.9e-271], t$95$3, If[LessEqual[a, 1.7e-47], t$95$1, If[LessEqual[a, 1.85e+50], t$95$3, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(y \cdot \left(z \cdot {t}^{-0.5}\right)\right) - t\\
t_2 := \log t \cdot a\\
t_3 := \left(\log z + \log y\right) - t\\
\mathbf{if}\;a \leq -700000:\\
\;\;\;\;\log \left(x + y\right) + t\_2\\
\mathbf{elif}\;a \leq -1.1 \cdot 10^{-267}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.9 \cdot 10^{-271}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;a \leq 1.7 \cdot 10^{-47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.85 \cdot 10^{+50}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -7e5Initial program 99.6%
associate-+l-99.6%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in a around inf 79.9%
*-commutative79.9%
Simplified79.9%
if -7e5 < a < -1.09999999999999994e-267 or 3.89999999999999997e-271 < a < 1.7000000000000001e-47Initial program 99.5%
remove-double-neg99.5%
associate--l+99.5%
remove-double-neg99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in a around 0 99.2%
Taylor expanded in x around 0 61.4%
+-commutative61.4%
Simplified61.4%
add-log-exp55.2%
sum-log42.7%
+-commutative42.7%
exp-sum42.6%
add-exp-log42.7%
*-commutative42.7%
exp-to-pow42.8%
Applied egg-rr42.8%
if -1.09999999999999994e-267 < a < 3.89999999999999997e-271 or 1.7000000000000001e-47 < a < 1.85e50Initial program 99.7%
associate-+l-99.7%
associate--l+99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-undefine99.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
metadata-eval99.8%
metadata-eval99.8%
unsub-neg99.8%
Simplified99.8%
Taylor expanded in t around inf 70.2%
Taylor expanded in x around 0 43.5%
if 1.85e50 < a Initial program 99.6%
expm1-log1p-u49.5%
expm1-undefine49.4%
Applied egg-rr49.4%
expm1-define49.5%
Simplified49.5%
*-un-lft-identity49.5%
+-commutative49.5%
sum-log37.6%
Applied egg-rr37.6%
*-lft-identity37.6%
+-commutative37.6%
Simplified37.6%
Taylor expanded in a around inf 80.8%
*-commutative80.8%
Simplified80.8%
Final simplification59.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 9e+163) (+ (log (* (+ x y) z)) (- (* (log t) (+ a -0.5)) t)) (+ (- 1.0 t) -1.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 9e+163) {
tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t);
} else {
tmp = (1.0 - t) + -1.0;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if (t <= 9d+163) then
tmp = log(((x + y) * z)) + ((log(t) * (a + (-0.5d0))) - t)
else
tmp = (1.0d0 - t) + (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 9e+163) {
tmp = Math.log(((x + y) * z)) + ((Math.log(t) * (a + -0.5)) - t);
} else {
tmp = (1.0 - t) + -1.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 9e+163: tmp = math.log(((x + y) * z)) + ((math.log(t) * (a + -0.5)) - t) else: tmp = (1.0 - t) + -1.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 9e+163) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(Float64(log(t) * Float64(a + -0.5)) - t)); else tmp = Float64(Float64(1.0 - t) + -1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 9e+163) tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t); else tmp = (1.0 - t) + -1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 9e+163], N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9 \cdot 10^{+163}:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \left(\log t \cdot \left(a + -0.5\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) + -1\\
\end{array}
\end{array}
if t < 8.99999999999999976e163Initial program 99.4%
remove-double-neg99.4%
associate--l+99.4%
remove-double-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
metadata-eval99.4%
sub-neg99.4%
associate-+r-99.4%
associate-+l-99.4%
+-commutative99.4%
sum-log78.9%
sub-neg78.9%
metadata-eval78.9%
*-commutative78.9%
Applied egg-rr78.9%
+-commutative78.9%
Simplified78.9%
if 8.99999999999999976e163 < t Initial program 100.0%
expm1-log1p-u99.8%
expm1-undefine99.8%
Applied egg-rr99.8%
expm1-define99.8%
Simplified99.8%
*-un-lft-identity99.8%
+-commutative99.8%
sum-log67.5%
Applied egg-rr67.5%
*-lft-identity67.5%
+-commutative67.5%
Simplified67.5%
Taylor expanded in t around inf 87.8%
neg-mul-187.8%
Simplified87.8%
expm1-log1p-u0.0%
expm1-undefine0.0%
Applied egg-rr0.0%
sub-neg0.0%
log1p-undefine0.0%
rem-exp-log87.8%
unsub-neg87.8%
metadata-eval87.8%
Simplified87.8%
Final simplification81.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.1e+18) (not (<= a 1.6e+50))) (* (log t) a) (+ (log (+ x y)) (- (log z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.1e+18) || !(a <= 1.6e+50)) {
tmp = log(t) * a;
} else {
tmp = log((x + y)) + (log(z) - t);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if ((a <= (-3.1d+18)) .or. (.not. (a <= 1.6d+50))) then
tmp = log(t) * a
else
tmp = log((x + y)) + (log(z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.1e+18) || !(a <= 1.6e+50)) {
tmp = Math.log(t) * a;
} else {
tmp = Math.log((x + y)) + (Math.log(z) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -3.1e+18) or not (a <= 1.6e+50): tmp = math.log(t) * a else: tmp = math.log((x + y)) + (math.log(z) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.1e+18) || !(a <= 1.6e+50)) tmp = Float64(log(t) * a); else tmp = Float64(log(Float64(x + y)) + Float64(log(z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -3.1e+18) || ~((a <= 1.6e+50))) tmp = log(t) * a; else tmp = log((x + y)) + (log(z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.1e+18], N[Not[LessEqual[a, 1.6e+50]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{+18} \lor \neg \left(a \leq 1.6 \cdot 10^{+50}\right):\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z - t\right)\\
\end{array}
\end{array}
if a < -3.1e18 or 1.59999999999999991e50 < a Initial program 99.6%
expm1-log1p-u45.6%
expm1-undefine45.6%
Applied egg-rr45.6%
expm1-define45.6%
Simplified45.6%
*-un-lft-identity45.6%
+-commutative45.6%
sum-log35.3%
Applied egg-rr35.3%
*-lft-identity35.3%
+-commutative35.3%
Simplified35.3%
Taylor expanded in a around inf 81.3%
*-commutative81.3%
Simplified81.3%
if -3.1e18 < a < 1.59999999999999991e50Initial program 99.5%
associate-+l-99.6%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in t around inf 59.9%
Final simplification69.3%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.7e+164) (- (+ (* (log t) (- a 0.5)) (log (* y z))) t) (+ (- 1.0 t) -1.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.7e+164) {
tmp = ((log(t) * (a - 0.5)) + log((y * z))) - t;
} else {
tmp = (1.0 - t) + -1.0;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if (t <= 1.7d+164) then
tmp = ((log(t) * (a - 0.5d0)) + log((y * z))) - t
else
tmp = (1.0d0 - t) + (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.7e+164) {
tmp = ((Math.log(t) * (a - 0.5)) + Math.log((y * z))) - t;
} else {
tmp = (1.0 - t) + -1.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.7e+164: tmp = ((math.log(t) * (a - 0.5)) + math.log((y * z))) - t else: tmp = (1.0 - t) + -1.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.7e+164) tmp = Float64(Float64(Float64(log(t) * Float64(a - 0.5)) + log(Float64(y * z))) - t); else tmp = Float64(Float64(1.0 - t) + -1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.7e+164) tmp = ((log(t) * (a - 0.5)) + log((y * z))) - t; else tmp = (1.0 - t) + -1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.7e+164], N[(N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.7 \cdot 10^{+164}:\\
\;\;\;\;\left(\log t \cdot \left(a - 0.5\right) + \log \left(y \cdot z\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) + -1\\
\end{array}
\end{array}
if t < 1.7000000000000001e164Initial program 99.4%
expm1-log1p-u32.6%
expm1-undefine32.6%
Applied egg-rr32.6%
expm1-define32.6%
Simplified32.6%
*-un-lft-identity32.6%
+-commutative32.6%
sum-log28.1%
Applied egg-rr28.1%
*-lft-identity28.1%
+-commutative28.1%
Simplified28.1%
Taylor expanded in x around 0 57.3%
if 1.7000000000000001e164 < t Initial program 100.0%
expm1-log1p-u99.8%
expm1-undefine99.8%
Applied egg-rr99.8%
expm1-define99.8%
Simplified99.8%
*-un-lft-identity99.8%
+-commutative99.8%
sum-log67.5%
Applied egg-rr67.5%
*-lft-identity67.5%
+-commutative67.5%
Simplified67.5%
Taylor expanded in t around inf 87.8%
neg-mul-187.8%
Simplified87.8%
expm1-log1p-u0.0%
expm1-undefine0.0%
Applied egg-rr0.0%
sub-neg0.0%
log1p-undefine0.0%
rem-exp-log87.8%
unsub-neg87.8%
metadata-eval87.8%
Simplified87.8%
Final simplification64.9%
(FPCore (x y z t a) :precision binary64 (if (<= t 21000.0) (+ (* (log t) (+ a -0.5)) (log (* (+ x y) z))) (+ (log (+ x y)) (- (log z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 21000.0) {
tmp = (log(t) * (a + -0.5)) + log(((x + y) * z));
} else {
tmp = log((x + y)) + (log(z) - t);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if (t <= 21000.0d0) then
tmp = (log(t) * (a + (-0.5d0))) + log(((x + y) * z))
else
tmp = log((x + y)) + (log(z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 21000.0) {
tmp = (Math.log(t) * (a + -0.5)) + Math.log(((x + y) * z));
} else {
tmp = Math.log((x + y)) + (Math.log(z) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 21000.0: tmp = (math.log(t) * (a + -0.5)) + math.log(((x + y) * z)) else: tmp = math.log((x + y)) + (math.log(z) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 21000.0) tmp = Float64(Float64(log(t) * Float64(a + -0.5)) + log(Float64(Float64(x + y) * z))); else tmp = Float64(log(Float64(x + y)) + Float64(log(z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 21000.0) tmp = (log(t) * (a + -0.5)) + log(((x + y) * z)); else tmp = log((x + y)) + (log(z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 21000.0], N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 21000:\\
\;\;\;\;\log t \cdot \left(a + -0.5\right) + \log \left(\left(x + y\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z - t\right)\\
\end{array}
\end{array}
if t < 21000Initial program 99.3%
expm1-log1p-u0.8%
expm1-undefine0.8%
Applied egg-rr0.8%
expm1-define0.8%
Simplified0.8%
*-un-lft-identity0.8%
+-commutative0.8%
sum-log0.8%
Applied egg-rr0.8%
*-lft-identity0.8%
+-commutative0.8%
Simplified0.8%
Taylor expanded in t around 0 75.0%
+-commutative75.0%
sub-neg75.0%
metadata-eval75.0%
+-commutative75.0%
Simplified75.0%
if 21000 < t Initial program 99.9%
associate-+l-99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-undefine99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 74.2%
Final simplification74.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.85e+21) (not (<= a 1.85e+50))) (* (log t) a) (- (+ (log z) (log y)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.85e+21) || !(a <= 1.85e+50)) {
tmp = log(t) * a;
} else {
tmp = (log(z) + log(y)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if ((a <= (-1.85d+21)) .or. (.not. (a <= 1.85d+50))) then
tmp = log(t) * a
else
tmp = (log(z) + log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.85e+21) || !(a <= 1.85e+50)) {
tmp = Math.log(t) * a;
} else {
tmp = (Math.log(z) + Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.85e+21) or not (a <= 1.85e+50): tmp = math.log(t) * a else: tmp = (math.log(z) + math.log(y)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.85e+21) || !(a <= 1.85e+50)) tmp = Float64(log(t) * a); else tmp = Float64(Float64(log(z) + log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.85e+21) || ~((a <= 1.85e+50))) tmp = log(t) * a; else tmp = (log(z) + log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.85e+21], N[Not[LessEqual[a, 1.85e+50]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.85 \cdot 10^{+21} \lor \neg \left(a \leq 1.85 \cdot 10^{+50}\right):\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(\log z + \log y\right) - t\\
\end{array}
\end{array}
if a < -1.85e21 or 1.85e50 < a Initial program 99.6%
expm1-log1p-u45.6%
expm1-undefine45.6%
Applied egg-rr45.6%
expm1-define45.6%
Simplified45.6%
*-un-lft-identity45.6%
+-commutative45.6%
sum-log35.3%
Applied egg-rr35.3%
*-lft-identity35.3%
+-commutative35.3%
Simplified35.3%
Taylor expanded in a around inf 81.3%
*-commutative81.3%
Simplified81.3%
if -1.85e21 < a < 1.85e50Initial program 99.5%
associate-+l-99.6%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in t around inf 59.9%
Taylor expanded in x around 0 39.3%
Final simplification57.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.15e+20) (not (<= a 2.7e+50))) (* (log t) a) (- (log y) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.15e+20) || !(a <= 2.7e+50)) {
tmp = log(t) * a;
} else {
tmp = log(y) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if ((a <= (-1.15d+20)) .or. (.not. (a <= 2.7d+50))) then
tmp = log(t) * a
else
tmp = log(y) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.15e+20) || !(a <= 2.7e+50)) {
tmp = Math.log(t) * a;
} else {
tmp = Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.15e+20) or not (a <= 2.7e+50): tmp = math.log(t) * a else: tmp = math.log(y) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.15e+20) || !(a <= 2.7e+50)) tmp = Float64(log(t) * a); else tmp = Float64(log(y) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.15e+20) || ~((a <= 2.7e+50))) tmp = log(t) * a; else tmp = log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.15e+20], N[Not[LessEqual[a, 2.7e+50]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.15 \cdot 10^{+20} \lor \neg \left(a \leq 2.7 \cdot 10^{+50}\right):\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;\log y - t\\
\end{array}
\end{array}
if a < -1.15e20 or 2.7e50 < a Initial program 99.6%
expm1-log1p-u45.6%
expm1-undefine45.6%
Applied egg-rr45.6%
expm1-define45.6%
Simplified45.6%
*-un-lft-identity45.6%
+-commutative45.6%
sum-log35.3%
Applied egg-rr35.3%
*-lft-identity35.3%
+-commutative35.3%
Simplified35.3%
Taylor expanded in a around inf 81.3%
*-commutative81.3%
Simplified81.3%
if -1.15e20 < a < 2.7e50Initial program 99.5%
associate-+l-99.6%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in t around inf 58.7%
neg-mul-158.7%
Simplified58.7%
Taylor expanded in x around 0 39.3%
Final simplification57.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.8e+19) (not (<= a 1.72e+50))) (* (log t) a) (+ (- 1.0 t) -1.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.8e+19) || !(a <= 1.72e+50)) {
tmp = log(t) * a;
} else {
tmp = (1.0 - t) + -1.0;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if ((a <= (-5.8d+19)) .or. (.not. (a <= 1.72d+50))) then
tmp = log(t) * a
else
tmp = (1.0d0 - t) + (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.8e+19) || !(a <= 1.72e+50)) {
tmp = Math.log(t) * a;
} else {
tmp = (1.0 - t) + -1.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5.8e+19) or not (a <= 1.72e+50): tmp = math.log(t) * a else: tmp = (1.0 - t) + -1.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.8e+19) || !(a <= 1.72e+50)) tmp = Float64(log(t) * a); else tmp = Float64(Float64(1.0 - t) + -1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -5.8e+19) || ~((a <= 1.72e+50))) tmp = log(t) * a; else tmp = (1.0 - t) + -1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.8e+19], N[Not[LessEqual[a, 1.72e+50]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{+19} \lor \neg \left(a \leq 1.72 \cdot 10^{+50}\right):\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) + -1\\
\end{array}
\end{array}
if a < -5.8e19 or 1.72e50 < a Initial program 99.6%
expm1-log1p-u45.6%
expm1-undefine45.6%
Applied egg-rr45.6%
expm1-define45.6%
Simplified45.6%
*-un-lft-identity45.6%
+-commutative45.6%
sum-log35.3%
Applied egg-rr35.3%
*-lft-identity35.3%
+-commutative35.3%
Simplified35.3%
Taylor expanded in a around inf 81.3%
*-commutative81.3%
Simplified81.3%
if -5.8e19 < a < 1.72e50Initial program 99.5%
expm1-log1p-u52.4%
expm1-undefine52.4%
Applied egg-rr52.4%
expm1-define52.4%
Simplified52.4%
*-un-lft-identity52.4%
+-commutative52.4%
sum-log40.1%
Applied egg-rr40.1%
*-lft-identity40.1%
+-commutative40.1%
Simplified40.1%
Taylor expanded in t around inf 52.8%
neg-mul-152.8%
Simplified52.8%
expm1-log1p-u1.5%
expm1-undefine1.6%
Applied egg-rr1.6%
sub-neg1.6%
log1p-undefine1.6%
rem-exp-log52.9%
unsub-neg52.9%
metadata-eval52.9%
Simplified52.9%
Final simplification65.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 600.0) (log y) (+ (- 1.0 t) -1.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 600.0) {
tmp = log(y);
} else {
tmp = (1.0 - t) + -1.0;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if (t <= 600.0d0) then
tmp = log(y)
else
tmp = (1.0d0 - t) + (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 600.0) {
tmp = Math.log(y);
} else {
tmp = (1.0 - t) + -1.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 600.0: tmp = math.log(y) else: tmp = (1.0 - t) + -1.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 600.0) tmp = log(y); else tmp = Float64(Float64(1.0 - t) + -1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 600.0) tmp = log(y); else tmp = (1.0 - t) + -1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 600.0], N[Log[y], $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 600:\\
\;\;\;\;\log y\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) + -1\\
\end{array}
\end{array}
if t < 600Initial program 99.3%
associate-+l-99.3%
associate--l+99.3%
sub-neg99.3%
+-commutative99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
fma-undefine99.3%
sub-neg99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in t around inf 9.8%
neg-mul-19.8%
Simplified9.8%
Taylor expanded in t around 0 9.8%
+-commutative9.8%
Simplified9.8%
Taylor expanded in y around inf 7.2%
mul-1-neg7.2%
log-rec7.2%
remove-double-neg7.2%
Simplified7.2%
if 600 < t Initial program 99.9%
expm1-log1p-u99.6%
expm1-undefine99.6%
Applied egg-rr99.6%
expm1-define99.6%
Simplified99.6%
*-un-lft-identity99.6%
+-commutative99.6%
sum-log76.5%
Applied egg-rr76.5%
*-lft-identity76.5%
+-commutative76.5%
Simplified76.5%
Taylor expanded in t around inf 73.5%
neg-mul-173.5%
Simplified73.5%
expm1-log1p-u0.0%
expm1-undefine0.0%
Applied egg-rr0.0%
sub-neg0.0%
log1p-undefine0.0%
rem-exp-log73.5%
unsub-neg73.5%
metadata-eval73.5%
Simplified73.5%
(FPCore (x y z t a) :precision binary64 (+ (- 1.0 t) -1.0))
double code(double x, double y, double z, double t, double a) {
return (1.0 - t) + -1.0;
}
real(8) function code(x, y, z, t, a)
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
code = (1.0d0 - t) + (-1.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return (1.0 - t) + -1.0;
}
def code(x, y, z, t, a): return (1.0 - t) + -1.0
function code(x, y, z, t, a) return Float64(Float64(1.0 - t) + -1.0) end
function tmp = code(x, y, z, t, a) tmp = (1.0 - t) + -1.0; end
code[x_, y_, z_, t_, a_] := N[(N[(1.0 - t), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - t\right) + -1
\end{array}
Initial program 99.6%
expm1-log1p-u49.4%
expm1-undefine49.4%
Applied egg-rr49.4%
expm1-define49.4%
Simplified49.4%
*-un-lft-identity49.4%
+-commutative49.4%
sum-log38.0%
Applied egg-rr38.0%
*-lft-identity38.0%
+-commutative38.0%
Simplified38.0%
Taylor expanded in t around inf 37.9%
neg-mul-137.9%
Simplified37.9%
expm1-log1p-u1.4%
expm1-undefine1.4%
Applied egg-rr1.4%
sub-neg1.4%
log1p-undefine1.4%
rem-exp-log37.9%
unsub-neg37.9%
metadata-eval37.9%
Simplified37.9%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
real(8) function code(x, y, z, t, a)
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
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.6%
expm1-log1p-u49.4%
expm1-undefine49.4%
Applied egg-rr49.4%
expm1-define49.4%
Simplified49.4%
*-un-lft-identity49.4%
+-commutative49.4%
sum-log38.0%
Applied egg-rr38.0%
*-lft-identity38.0%
+-commutative38.0%
Simplified38.0%
Taylor expanded in t around inf 37.9%
neg-mul-137.9%
Simplified37.9%
(FPCore (x y z t a) :precision binary64 (+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t)))))
double code(double x, double y, double z, double t, double a) {
return log((x + y)) + ((log(z) - t) + ((a - 0.5) * log(t)));
}
real(8) function code(x, y, z, t, a)
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
code = log((x + y)) + ((log(z) - t) + ((a - 0.5d0) * log(t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return Math.log((x + y)) + ((Math.log(z) - t) + ((a - 0.5) * Math.log(t)));
}
def code(x, y, z, t, a): return math.log((x + y)) + ((math.log(z) - t) + ((a - 0.5) * math.log(t)))
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + Float64(Float64(log(z) - t) + Float64(Float64(a - 0.5) * log(t)))) end
function tmp = code(x, y, z, t, a) tmp = log((x + y)) + ((log(z) - t) + ((a - 0.5) * log(t))); end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \left(\left(\log z - t\right) + \left(a - 0.5\right) \cdot \log t\right)
\end{array}
herbie shell --seed 2024110
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:alt
(+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))