
(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 12 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)) 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(Float64(log(Float64(x + y)) + 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[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \log t \cdot \left(a - 0.5\right)
\end{array}
Initial program 99.6%
Final simplification99.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* a (log t)) t)))
(if (<= a -3.2e-9)
t_1
(if (<= a 1.06e-243)
(- (+ (log y) (log (/ z (sqrt t)))) t)
(if (<= a 0.49) (- (+ (log z) (log (/ y (sqrt t)))) t) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (a * log(t)) - t;
double tmp;
if (a <= -3.2e-9) {
tmp = t_1;
} else if (a <= 1.06e-243) {
tmp = (log(y) + log((z / sqrt(t)))) - t;
} else if (a <= 0.49) {
tmp = (log(z) + log((y / sqrt(t)))) - 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 = (a * log(t)) - t
if (a <= (-3.2d-9)) then
tmp = t_1
else if (a <= 1.06d-243) then
tmp = (log(y) + log((z / sqrt(t)))) - t
else if (a <= 0.49d0) then
tmp = (log(z) + log((y / sqrt(t)))) - 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 = (a * Math.log(t)) - t;
double tmp;
if (a <= -3.2e-9) {
tmp = t_1;
} else if (a <= 1.06e-243) {
tmp = (Math.log(y) + Math.log((z / Math.sqrt(t)))) - t;
} else if (a <= 0.49) {
tmp = (Math.log(z) + Math.log((y / Math.sqrt(t)))) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (a * math.log(t)) - t tmp = 0 if a <= -3.2e-9: tmp = t_1 elif a <= 1.06e-243: tmp = (math.log(y) + math.log((z / math.sqrt(t)))) - t elif a <= 0.49: tmp = (math.log(z) + math.log((y / math.sqrt(t)))) - t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(a * log(t)) - t) tmp = 0.0 if (a <= -3.2e-9) tmp = t_1; elseif (a <= 1.06e-243) tmp = Float64(Float64(log(y) + log(Float64(z / sqrt(t)))) - t); elseif (a <= 0.49) tmp = Float64(Float64(log(z) + log(Float64(y / sqrt(t)))) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (a * log(t)) - t; tmp = 0.0; if (a <= -3.2e-9) tmp = t_1; elseif (a <= 1.06e-243) tmp = (log(y) + log((z / sqrt(t)))) - t; elseif (a <= 0.49) tmp = (log(z) + log((y / sqrt(t)))) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[a, -3.2e-9], t$95$1, If[LessEqual[a, 1.06e-243], N[(N[(N[Log[y], $MachinePrecision] + N[Log[N[(z / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[a, 0.49], N[(N[(N[Log[z], $MachinePrecision] + N[Log[N[(y / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \log t - t\\
\mathbf{if}\;a \leq -3.2 \cdot 10^{-9}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 1.06 \cdot 10^{-243}:\\
\;\;\;\;\left(\log y + \log \left(\frac{z}{\sqrt{t}}\right)\right) - t\\
\mathbf{elif}\;a \leq 0.49:\\
\;\;\;\;\left(\log z + \log \left(\frac{y}{\sqrt{t}}\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if a < -3.20000000000000012e-9 or 0.48999999999999999 < a Initial program 99.8%
associate-+l-99.8%
+-commutative99.8%
associate--l+99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
metadata-eval99.8%
metadata-eval99.8%
unsub-neg99.8%
Simplified99.8%
associate-+r-99.8%
+-commutative99.8%
fma-udef99.8%
associate--r+99.8%
+-commutative99.8%
sum-log81.0%
Applied egg-rr81.0%
Taylor expanded in x around 0 57.6%
Taylor expanded in a around inf 97.1%
*-commutative97.1%
Simplified97.1%
if -3.20000000000000012e-9 < a < 1.06e-243Initial program 99.5%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.4%
+-commutative99.4%
fma-def99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
+-commutative99.4%
fma-udef99.4%
metadata-eval99.4%
sub-neg99.4%
associate-+r+99.5%
associate--l+99.5%
add-log-exp36.9%
exp-sum35.7%
sub-neg35.7%
metadata-eval35.7%
*-commutative35.7%
exp-to-pow35.7%
associate--l+35.7%
exp-sum35.7%
Applied egg-rr36.1%
Taylor expanded in x around 0 23.8%
log-div23.1%
exp-to-pow23.1%
sub-neg23.1%
metadata-eval23.1%
rem-log-exp41.8%
Simplified41.8%
Taylor expanded in a around 0 41.8%
*-commutative41.8%
log-prod55.5%
*-commutative55.5%
sqrt-div55.5%
metadata-eval55.5%
un-div-inv55.5%
Applied egg-rr55.5%
if 1.06e-243 < a < 0.48999999999999999Initial program 99.4%
associate--l+99.4%
+-commutative99.4%
associate-+l+99.4%
+-commutative99.4%
fma-def99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
+-commutative99.4%
fma-udef99.4%
metadata-eval99.4%
sub-neg99.4%
associate-+r+99.4%
associate--l+99.4%
add-log-exp42.4%
exp-sum41.6%
sub-neg41.6%
metadata-eval41.6%
*-commutative41.6%
exp-to-pow41.6%
associate--l+41.6%
exp-sum41.8%
Applied egg-rr42.0%
Taylor expanded in x around 0 21.7%
log-div21.6%
exp-to-pow21.7%
sub-neg21.7%
metadata-eval21.7%
rem-log-exp38.7%
Simplified38.7%
Taylor expanded in a around 0 38.4%
associate-*r*40.5%
log-prod57.9%
sqrt-div57.9%
metadata-eval57.9%
un-div-inv57.9%
Applied egg-rr57.9%
Final simplification76.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2300000000000.0) (not (<= a 0.68))) (- (* a (log t)) t) (- (+ (log z) (log (/ y (sqrt t)))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2300000000000.0) || !(a <= 0.68)) {
tmp = (a * log(t)) - t;
} else {
tmp = (log(z) + log((y / sqrt(t)))) - 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 <= (-2300000000000.0d0)) .or. (.not. (a <= 0.68d0))) then
tmp = (a * log(t)) - t
else
tmp = (log(z) + log((y / sqrt(t)))) - 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 <= -2300000000000.0) || !(a <= 0.68)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = (Math.log(z) + Math.log((y / Math.sqrt(t)))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2300000000000.0) or not (a <= 0.68): tmp = (a * math.log(t)) - t else: tmp = (math.log(z) + math.log((y / math.sqrt(t)))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2300000000000.0) || !(a <= 0.68)) tmp = Float64(Float64(a * log(t)) - t); else tmp = Float64(Float64(log(z) + log(Float64(y / sqrt(t)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2300000000000.0) || ~((a <= 0.68))) tmp = (a * log(t)) - t; else tmp = (log(z) + log((y / sqrt(t)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2300000000000.0], N[Not[LessEqual[a, 0.68]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] + N[Log[N[(y / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2300000000000 \lor \neg \left(a \leq 0.68\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z + \log \left(\frac{y}{\sqrt{t}}\right)\right) - t\\
\end{array}
\end{array}
if a < -2.3e12 or 0.680000000000000049 < a Initial program 99.8%
associate-+l-99.8%
+-commutative99.8%
associate--l+99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
metadata-eval99.8%
metadata-eval99.8%
unsub-neg99.8%
Simplified99.8%
associate-+r-99.8%
+-commutative99.8%
fma-udef99.8%
associate--r+99.8%
+-commutative99.8%
sum-log81.7%
Applied egg-rr81.7%
Taylor expanded in x around 0 57.9%
Taylor expanded in a around inf 99.1%
*-commutative99.1%
Simplified99.1%
if -2.3e12 < a < 0.680000000000000049Initial program 99.5%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.4%
+-commutative99.4%
fma-def99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
+-commutative99.4%
fma-udef99.4%
metadata-eval99.4%
sub-neg99.4%
associate-+r+99.5%
associate--l+99.5%
add-log-exp38.1%
exp-sum37.2%
sub-neg37.2%
metadata-eval37.2%
*-commutative37.2%
exp-to-pow37.2%
associate--l+37.1%
exp-sum37.2%
Applied egg-rr37.5%
Taylor expanded in x around 0 22.2%
log-div21.7%
exp-to-pow21.7%
sub-neg21.7%
metadata-eval21.7%
rem-log-exp39.0%
Simplified39.0%
Taylor expanded in a around 0 40.3%
associate-*r*41.2%
log-prod54.1%
sqrt-div54.1%
metadata-eval54.1%
un-div-inv54.1%
Applied egg-rr54.1%
Final simplification74.9%
(FPCore (x y z t a) :precision binary64 (if (<= t 235.0) (+ (+ (log z) (log y)) (* (log t) (- a 0.5))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 235.0) {
tmp = (log(z) + log(y)) + (log(t) * (a - 0.5));
} else {
tmp = (a * log(t)) - 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 <= 235.0d0) then
tmp = (log(z) + log(y)) + (log(t) * (a - 0.5d0))
else
tmp = (a * log(t)) - 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 <= 235.0) {
tmp = (Math.log(z) + Math.log(y)) + (Math.log(t) * (a - 0.5));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 235.0: tmp = (math.log(z) + math.log(y)) + (math.log(t) * (a - 0.5)) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 235.0) tmp = Float64(Float64(log(z) + log(y)) + Float64(log(t) * Float64(a - 0.5))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 235.0) tmp = (log(z) + log(y)) + (log(t) * (a - 0.5)); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 235.0], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 235:\\
\;\;\;\;\left(\log z + \log y\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 235Initial program 99.3%
associate-+l-99.3%
+-commutative99.3%
associate--l+99.3%
sub-neg99.3%
+-commutative99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
fma-def99.3%
sub-neg99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in x around 0 62.0%
Taylor expanded in t around 0 61.9%
if 235 < t Initial program 99.9%
associate-+l-99.9%
+-commutative99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
associate-+r-99.9%
+-commutative99.9%
fma-udef99.9%
associate--r+99.9%
+-commutative99.9%
sum-log77.7%
Applied egg-rr77.7%
Taylor expanded in x around 0 59.6%
Taylor expanded in a around inf 99.6%
*-commutative99.6%
Simplified99.6%
Final simplification80.2%
(FPCore (x y z t a) :precision binary64 (+ (+ (log z) (log y)) (- (* (log t) (- a 0.5)) t)))
double code(double x, double y, double z, double t, double a) {
return (log(z) + log(y)) + ((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(z) + log(y)) + ((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(z) + Math.log(y)) + ((Math.log(t) * (a - 0.5)) - t);
}
def code(x, y, z, t, a): return (math.log(z) + math.log(y)) + ((math.log(t) * (a - 0.5)) - t)
function code(x, y, z, t, a) return Float64(Float64(log(z) + log(y)) + Float64(Float64(log(t) * Float64(a - 0.5)) - t)) end
function tmp = code(x, y, z, t, a) tmp = (log(z) + log(y)) + ((log(t) * (a - 0.5)) - t); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z + \log y\right) + \left(\log t \cdot \left(a - 0.5\right) - t\right)
\end{array}
Initial program 99.6%
associate-+l-99.6%
+-commutative99.6%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-def99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in x around 0 67.1%
Final simplification67.1%
(FPCore (x y z t a) :precision binary64 (if (<= t 195000000000.0) (- (+ (log (* y z)) (* (log t) (- a 0.5))) t) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 195000000000.0) {
tmp = (log((y * z)) + (log(t) * (a - 0.5))) - t;
} else {
tmp = (a * log(t)) - 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 <= 195000000000.0d0) then
tmp = (log((y * z)) + (log(t) * (a - 0.5d0))) - t
else
tmp = (a * log(t)) - 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 <= 195000000000.0) {
tmp = (Math.log((y * z)) + (Math.log(t) * (a - 0.5))) - t;
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 195000000000.0: tmp = (math.log((y * z)) + (math.log(t) * (a - 0.5))) - t else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 195000000000.0) tmp = Float64(Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5))) - t); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 195000000000.0) tmp = (log((y * z)) + (log(t) * (a - 0.5))) - t; else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 195000000000.0], N[(N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 195000000000:\\
\;\;\;\;\left(\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 1.95e11Initial program 99.3%
associate-+l-99.3%
+-commutative99.3%
associate--l+99.3%
sub-neg99.3%
+-commutative99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
fma-def99.3%
sub-neg99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
associate-+r-99.3%
+-commutative99.3%
fma-udef99.3%
associate--r+99.3%
+-commutative99.3%
sum-log80.3%
Applied egg-rr80.3%
Taylor expanded in x around 0 47.6%
if 1.95e11 < t Initial program 99.9%
associate-+l-99.9%
+-commutative99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
associate-+r-99.9%
+-commutative99.9%
fma-udef99.9%
associate--r+99.9%
+-commutative99.9%
sum-log77.5%
Applied egg-rr77.5%
Taylor expanded in x around 0 60.0%
Taylor expanded in a around inf 99.9%
*-commutative99.9%
Simplified99.9%
Final simplification72.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.5e-40) (not (<= a 0.038))) (- (* a (log t)) t) (- (log (* y (/ z (sqrt t)))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.5e-40) || !(a <= 0.038)) {
tmp = (a * log(t)) - t;
} else {
tmp = log((y * (z / sqrt(t)))) - 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 <= (-5.5d-40)) .or. (.not. (a <= 0.038d0))) then
tmp = (a * log(t)) - t
else
tmp = log((y * (z / sqrt(t)))) - 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 <= -5.5e-40) || !(a <= 0.038)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = Math.log((y * (z / Math.sqrt(t)))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5.5e-40) or not (a <= 0.038): tmp = (a * math.log(t)) - t else: tmp = math.log((y * (z / math.sqrt(t)))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.5e-40) || !(a <= 0.038)) tmp = Float64(Float64(a * log(t)) - t); else tmp = Float64(log(Float64(y * Float64(z / sqrt(t)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -5.5e-40) || ~((a <= 0.038))) tmp = (a * log(t)) - t; else tmp = log((y * (z / sqrt(t)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.5e-40], N[Not[LessEqual[a, 0.038]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(y * N[(z / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.5 \cdot 10^{-40} \lor \neg \left(a \leq 0.038\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot \frac{z}{\sqrt{t}}\right) - t\\
\end{array}
\end{array}
if a < -5.50000000000000002e-40 or 0.0379999999999999991 < a Initial program 99.8%
associate-+l-99.8%
+-commutative99.8%
associate--l+99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
metadata-eval99.8%
metadata-eval99.8%
unsub-neg99.8%
Simplified99.8%
associate-+r-99.8%
+-commutative99.8%
fma-udef99.8%
associate--r+99.8%
+-commutative99.8%
sum-log80.7%
Applied egg-rr80.7%
Taylor expanded in x around 0 57.0%
Taylor expanded in a around inf 95.7%
*-commutative95.7%
Simplified95.7%
if -5.50000000000000002e-40 < a < 0.0379999999999999991Initial program 99.5%
associate--l+99.4%
+-commutative99.4%
associate-+l+99.4%
+-commutative99.4%
fma-def99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
+-commutative99.4%
fma-udef99.4%
metadata-eval99.4%
sub-neg99.4%
associate-+r+99.4%
associate--l+99.5%
add-log-exp39.8%
exp-sum38.7%
sub-neg38.7%
metadata-eval38.7%
*-commutative38.7%
exp-to-pow38.7%
associate--l+38.7%
exp-sum38.7%
Applied egg-rr39.1%
Taylor expanded in x around 0 23.5%
log-div23.0%
exp-to-pow23.1%
sub-neg23.1%
metadata-eval23.1%
rem-log-exp41.5%
Simplified41.5%
Taylor expanded in a around 0 41.4%
expm1-log1p-u41.4%
expm1-udef19.4%
*-commutative19.4%
sqrt-div19.4%
metadata-eval19.4%
un-div-inv19.4%
Applied egg-rr19.4%
expm1-def41.4%
expm1-log1p41.4%
Simplified41.4%
Final simplification68.3%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.112) (+ (log (* y z)) (* (log t) (- a 0.5))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.112) {
tmp = log((y * z)) + (log(t) * (a - 0.5));
} else {
tmp = (a * log(t)) - 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 <= 0.112d0) then
tmp = log((y * z)) + (log(t) * (a - 0.5d0))
else
tmp = (a * log(t)) - 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 <= 0.112) {
tmp = Math.log((y * z)) + (Math.log(t) * (a - 0.5));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.112: tmp = math.log((y * z)) + (math.log(t) * (a - 0.5)) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.112) tmp = Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 0.112) tmp = log((y * z)) + (log(t) * (a - 0.5)); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.112], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.112:\\
\;\;\;\;\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 0.112000000000000002Initial program 99.3%
associate-+l-99.3%
+-commutative99.3%
associate--l+99.3%
sub-neg99.3%
+-commutative99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
fma-def99.3%
sub-neg99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in x around 0 62.0%
Taylor expanded in t around 0 61.9%
log-prod47.9%
*-commutative47.9%
Simplified47.9%
if 0.112000000000000002 < t Initial program 99.9%
associate-+l-99.9%
+-commutative99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
associate-+r-99.9%
+-commutative99.9%
fma-udef99.9%
associate--r+99.9%
+-commutative99.9%
sum-log77.7%
Applied egg-rr77.7%
Taylor expanded in x around 0 59.6%
Taylor expanded in a around inf 99.6%
*-commutative99.6%
Simplified99.6%
Final simplification72.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2300000000000.0) (not (<= a 2.6))) (- (* a (log t)) t) (- (+ (log z) (log y)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2300000000000.0) || !(a <= 2.6)) {
tmp = (a * log(t)) - t;
} 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 <= (-2300000000000.0d0)) .or. (.not. (a <= 2.6d0))) then
tmp = (a * log(t)) - t
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 <= -2300000000000.0) || !(a <= 2.6)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = (Math.log(z) + Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2300000000000.0) or not (a <= 2.6): tmp = (a * math.log(t)) - t else: tmp = (math.log(z) + math.log(y)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2300000000000.0) || !(a <= 2.6)) tmp = Float64(Float64(a * log(t)) - t); 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 <= -2300000000000.0) || ~((a <= 2.6))) tmp = (a * log(t)) - t; else tmp = (log(z) + log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2300000000000.0], N[Not[LessEqual[a, 2.6]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2300000000000 \lor \neg \left(a \leq 2.6\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z + \log y\right) - t\\
\end{array}
\end{array}
if a < -2.3e12 or 2.60000000000000009 < a Initial program 99.8%
associate-+l-99.8%
+-commutative99.8%
associate--l+99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
metadata-eval99.8%
metadata-eval99.8%
unsub-neg99.8%
Simplified99.8%
associate-+r-99.8%
+-commutative99.8%
fma-udef99.8%
associate--r+99.8%
+-commutative99.8%
sum-log81.7%
Applied egg-rr81.7%
Taylor expanded in x around 0 57.9%
Taylor expanded in a around inf 99.1%
*-commutative99.1%
Simplified99.1%
if -2.3e12 < a < 2.60000000000000009Initial program 99.5%
associate-+l-99.5%
+-commutative99.5%
associate--l+99.4%
sub-neg99.4%
+-commutative99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
fma-def99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
metadata-eval99.4%
metadata-eval99.4%
unsub-neg99.4%
Simplified99.4%
Taylor expanded in x around 0 62.5%
Taylor expanded in t around inf 38.2%
Final simplification66.3%
(FPCore (x y z t a) :precision binary64 (if (<= t 5.7e+30) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5.7e+30) {
tmp = a * log(t);
} else {
tmp = -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 <= 5.7d+30) then
tmp = a * log(t)
else
tmp = -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 <= 5.7e+30) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 5.7e+30: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 5.7e+30) tmp = Float64(a * log(t)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 5.7e+30) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 5.7e+30], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5.7 \cdot 10^{+30}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 5.7000000000000002e30Initial program 99.3%
associate-+l-99.4%
+-commutative99.4%
associate--l+99.3%
sub-neg99.3%
+-commutative99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
fma-def99.3%
sub-neg99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in a around inf 46.2%
*-commutative46.2%
Simplified46.2%
if 5.7000000000000002e30 < t Initial program 99.9%
associate-+l-99.9%
+-commutative99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.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 81.8%
neg-mul-181.8%
Simplified81.8%
Final simplification62.5%
(FPCore (x y z t a) :precision binary64 (- (* a (log t)) t))
double code(double x, double y, double z, double t, double a) {
return (a * log(t)) - 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 = (a * log(t)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (a * Math.log(t)) - t;
}
def code(x, y, z, t, a): return (a * math.log(t)) - t
function code(x, y, z, t, a) return Float64(Float64(a * log(t)) - t) end
function tmp = code(x, y, z, t, a) tmp = (a * log(t)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \log t - t
\end{array}
Initial program 99.6%
associate-+l-99.6%
+-commutative99.6%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-def99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
associate-+r-99.6%
+-commutative99.6%
fma-udef99.6%
associate--r+99.6%
+-commutative99.6%
sum-log79.0%
Applied egg-rr79.0%
Taylor expanded in x around 0 53.6%
Taylor expanded in a around inf 70.8%
*-commutative70.8%
Simplified70.8%
Final simplification70.8%
(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%
associate-+l-99.6%
+-commutative99.6%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-def99.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 39.1%
neg-mul-139.1%
Simplified39.1%
Final simplification39.1%
(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 2023310
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))