
(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 10 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}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (+ (log y) (fma (log t) (+ a -0.5) (- (log z) t))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return log(y) + fma(log(t), (a + -0.5), (log(z) - t));
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(log(y) + fma(log(t), Float64(a + -0.5), Float64(log(z) - t))) end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\log y + \mathsf{fma}\left(\log t, a + -0.5, \log z - t\right)
\end{array}
Initial program 99.6%
Taylor expanded in x around 0
associate--l+N/A
lower-+.f64N/A
lower-log.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower--.f64N/A
lower-log.f6466.7
Applied rewrites66.7%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (- (+ (log z) (log (+ x y))) t) (* (log t) (- a 0.5))))
(t_2 (* a (log t))))
(if (<= t_1 -5e+27)
(- t_2 t)
(if (<= t_1 860.0)
(- (log (* y z)) (fma (log t) 0.5 t))
(- (+ (log z) t_2) t)))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = ((log(z) + log((x + y))) - t) + (log(t) * (a - 0.5));
double t_2 = a * log(t);
double tmp;
if (t_1 <= -5e+27) {
tmp = t_2 - t;
} else if (t_1 <= 860.0) {
tmp = log((y * z)) - fma(log(t), 0.5, t);
} else {
tmp = (log(z) + t_2) - t;
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(log(z) + log(Float64(x + y))) - t) + Float64(log(t) * Float64(a - 0.5))) t_2 = Float64(a * log(t)) tmp = 0.0 if (t_1 <= -5e+27) tmp = Float64(t_2 - t); elseif (t_1 <= 860.0) tmp = Float64(log(Float64(y * z)) - fma(log(t), 0.5, t)); else tmp = Float64(Float64(log(z) + t_2) - t); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[Log[z], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+27], N[(t$95$2 - t), $MachinePrecision], If[LessEqual[t$95$1, 860.0], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * 0.5 + t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] + t$95$2), $MachinePrecision] - t), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \left(\left(\log z + \log \left(x + y\right)\right) - t\right) + \log t \cdot \left(a - 0.5\right)\\
t_2 := a \cdot \log t\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+27}:\\
\;\;\;\;t\_2 - t\\
\mathbf{elif}\;t\_1 \leq 860:\\
\;\;\;\;\log \left(y \cdot z\right) - \mathsf{fma}\left(\log t, 0.5, t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log z + t\_2\right) - t\\
\end{array}
\end{array}
if (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < -4.99999999999999979e27Initial program 99.9%
Taylor expanded in x around 0
associate--l+N/A
lower-+.f64N/A
lower-log.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower--.f64N/A
lower-log.f6472.2
Applied rewrites72.2%
Applied rewrites72.2%
Taylor expanded in a around inf
Applied rewrites99.9%
if -4.99999999999999979e27 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 860Initial program 99.0%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
lower--.f6492.5
lift--.f64N/A
sub-negN/A
lower-+.f64N/A
metadata-eval92.5
Applied rewrites92.5%
Taylor expanded in x around 0
lower-*.f6449.6
Applied rewrites49.6%
Taylor expanded in a around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f6446.5
Applied rewrites46.5%
if 860 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) Initial program 99.6%
Taylor expanded in x around 0
associate--l+N/A
lower-+.f64N/A
lower-log.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower--.f64N/A
lower-log.f6462.7
Applied rewrites62.7%
Applied rewrites62.6%
Taylor expanded in a around inf
Applied rewrites82.9%
Final simplification85.4%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log z) (log (+ x y)))) (t_2 (- (+ (log z) (* a (log t))) t)))
(if (<= t_1 -800.0)
t_2
(if (<= t_1 608.0) (- (fma (log t) (+ a -0.5) (log (* y z))) t) t_2))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = log(z) + log((x + y));
double t_2 = (log(z) + (a * log(t))) - t;
double tmp;
if (t_1 <= -800.0) {
tmp = t_2;
} else if (t_1 <= 608.0) {
tmp = fma(log(t), (a + -0.5), log((y * z))) - t;
} else {
tmp = t_2;
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(log(z) + log(Float64(x + y))) t_2 = Float64(Float64(log(z) + Float64(a * log(t))) - t) tmp = 0.0 if (t_1 <= -800.0) tmp = t_2; elseif (t_1 <= 608.0) tmp = Float64(fma(log(t), Float64(a + -0.5), log(Float64(y * z))) - t); else tmp = t_2; end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[z], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Log[z], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, -800.0], t$95$2, If[LessEqual[t$95$1, 608.0], N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \log z + \log \left(x + y\right)\\
t_2 := \left(\log z + a \cdot \log t\right) - t\\
\mathbf{if}\;t\_1 \leq -800:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 608:\\
\;\;\;\;\mathsf{fma}\left(\log t, a + -0.5, \log \left(y \cdot z\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -800 or 608 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in x around 0
associate--l+N/A
lower-+.f64N/A
lower-log.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower--.f64N/A
lower-log.f6458.4
Applied rewrites58.4%
Applied rewrites58.4%
Taylor expanded in a around inf
Applied rewrites78.3%
if -800 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 608Initial program 99.7%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
lower--.f6499.6
lift--.f64N/A
sub-negN/A
lower-+.f64N/A
metadata-eval99.6
Applied rewrites99.6%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f6467.1
Applied rewrites67.1%
Final simplification70.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 1e-17) (+ (log y) (fma (log t) (+ a -0.5) (log z))) (- (+ (log z) (* a (log t))) t)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1e-17) {
tmp = log(y) + fma(log(t), (a + -0.5), log(z));
} else {
tmp = (log(z) + (a * log(t))) - t;
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 1e-17) tmp = Float64(log(y) + fma(log(t), Float64(a + -0.5), log(z))); else tmp = Float64(Float64(log(z) + Float64(a * log(t))) - t); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1e-17], N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 10^{-17}:\\
\;\;\;\;\log y + \mathsf{fma}\left(\log t, a + -0.5, \log z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log z + a \cdot \log t\right) - t\\
\end{array}
\end{array}
if t < 1.00000000000000007e-17Initial program 99.3%
Taylor expanded in x around 0
associate--l+N/A
lower-+.f64N/A
lower-log.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower--.f64N/A
lower-log.f6458.3
Applied rewrites58.3%
Taylor expanded in t around 0
Applied rewrites58.3%
if 1.00000000000000007e-17 < t Initial program 99.9%
Taylor expanded in x around 0
associate--l+N/A
lower-+.f64N/A
lower-log.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower--.f64N/A
lower-log.f6472.9
Applied rewrites72.9%
Applied rewrites72.9%
Taylor expanded in a around inf
Applied rewrites98.5%
Final simplification81.5%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (+ (- t) (* (* a (log t)) (+ 1.0 (/ -0.5 a)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return -t + ((a * log(t)) * (1.0 + (-0.5 / a)));
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 + ((a * log(t)) * (1.0d0 + ((-0.5d0) / a)))
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return -t + ((a * Math.log(t)) * (1.0 + (-0.5 / a)));
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return -t + ((a * math.log(t)) * (1.0 + (-0.5 / a)))
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(Float64(-t) + Float64(Float64(a * log(t)) * Float64(1.0 + Float64(-0.5 / a)))) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = -t + ((a * log(t)) * (1.0 + (-0.5 / a)));
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[((-t) + N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\left(-t\right) + \left(a \cdot \log t\right) \cdot \left(1 + \frac{-0.5}{a}\right)
\end{array}
Initial program 99.6%
Taylor expanded in t around -inf
mul-1-negN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
distribute-neg-inN/A
*-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in a around inf
*-lft-identityN/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-inN/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
sub-negN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
sub-negN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
Applied rewrites99.6%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6480.8
Applied rewrites80.8%
Final simplification80.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (let* ((t_1 (* a (log t)))) (if (<= a -2.2e+113) t_1 (if (<= a 2.85e+85) (+ (log y) (- t)) t_1))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = a * log(t);
double tmp;
if (a <= -2.2e+113) {
tmp = t_1;
} else if (a <= 2.85e+85) {
tmp = log(y) + -t;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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)
if (a <= (-2.2d+113)) then
tmp = t_1
else if (a <= 2.85d+85) then
tmp = log(y) + -t
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a * Math.log(t);
double tmp;
if (a <= -2.2e+113) {
tmp = t_1;
} else if (a <= 2.85e+85) {
tmp = Math.log(y) + -t;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = a * math.log(t) tmp = 0 if a <= -2.2e+113: tmp = t_1 elif a <= 2.85e+85: tmp = math.log(y) + -t else: tmp = t_1 return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(a * log(t)) tmp = 0.0 if (a <= -2.2e+113) tmp = t_1; elseif (a <= 2.85e+85) tmp = Float64(log(y) + Float64(-t)); else tmp = t_1; end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = a * log(t);
tmp = 0.0;
if (a <= -2.2e+113)
tmp = t_1;
elseif (a <= 2.85e+85)
tmp = log(y) + -t;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.2e+113], t$95$1, If[LessEqual[a, 2.85e+85], N[(N[Log[y], $MachinePrecision] + (-t)), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := a \cdot \log t\\
\mathbf{if}\;a \leq -2.2 \cdot 10^{+113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.85 \cdot 10^{+85}:\\
\;\;\;\;\log y + \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.2000000000000001e113 or 2.8500000000000001e85 < a Initial program 99.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6487.7
Applied rewrites87.7%
if -2.2000000000000001e113 < a < 2.8500000000000001e85Initial program 99.6%
Taylor expanded in x around 0
associate--l+N/A
lower-+.f64N/A
lower-log.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower--.f64N/A
lower-log.f6463.7
Applied rewrites63.7%
Taylor expanded in t around inf
Applied rewrites43.9%
Final simplification58.9%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (+ (* (log t) (- a 0.5)) (- t)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return (log(t) * (a - 0.5)) + -t;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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(t) * (a - 0.5d0)) + -t
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(t) * (a - 0.5)) + -t;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return (math.log(t) * (a - 0.5)) + -t
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(Float64(log(t) * Float64(a - 0.5)) + Float64(-t)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = (log(t) * (a - 0.5)) + -t;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + (-t)), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\log t \cdot \left(a - 0.5\right) + \left(-t\right)
\end{array}
Initial program 99.6%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6480.8
Applied rewrites80.8%
Final simplification80.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 1.4e+49) (* a (log t)) (- t)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.4e+49) {
tmp = a * log(t);
} else {
tmp = -t;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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.4d+49) then
tmp = a * log(t)
else
tmp = -t
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.4e+49) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if t <= 1.4e+49: tmp = a * math.log(t) else: tmp = -t return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.4e+49) tmp = Float64(a * log(t)); else tmp = Float64(-t); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= 1.4e+49)
tmp = a * log(t);
else
tmp = -t;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.4e+49], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.4 \cdot 10^{+49}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 1.3999999999999999e49Initial program 99.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6453.5
Applied rewrites53.5%
if 1.3999999999999999e49 < t Initial program 100.0%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6481.7
Applied rewrites81.7%
Final simplification66.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (- (* a (log t)) t))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return (a * log(t)) - t;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return (a * Math.log(t)) - t;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return (a * math.log(t)) - t
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(Float64(a * log(t)) - t) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = (a * log(t)) - t;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
a \cdot \log t - t
\end{array}
Initial program 99.6%
Taylor expanded in x around 0
associate--l+N/A
lower-+.f64N/A
lower-log.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower--.f64N/A
lower-log.f6466.7
Applied rewrites66.7%
Applied rewrites66.7%
Taylor expanded in a around inf
Applied rewrites78.0%
Final simplification78.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (- t))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return -t;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return -t
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(-t) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = -t;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
-t
\end{array}
Initial program 99.6%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6441.2
Applied rewrites41.2%
(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 2024233
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (+ (log (+ x y)) (+ (- (log z) t) (* (- a 1/2) (log t)))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))