
(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}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (- (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) t))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return (log(y) + (log(z) + (log(t) * (a - 0.5)))) - t;
}
NOTE: x and y 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(y) + (log(z) + (log(t) * (a - 0.5d0)))) - t
end function
assert x < y;
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;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return (math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5)))) - t
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))) - t) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = (log(y) + (log(z) + (log(t) * (a - 0.5)))) - t;
end
NOTE: x and y should be sorted in increasing order before calling this function. 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}
[x, y] = \mathsf{sort}([x, y])\\
\\
\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t
\end{array}
Initial program 99.5%
associate--l+99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 69.3%
Final simplification69.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= (- a 0.5) -1e+18) (not (<= (- a 0.5) -0.4))) (- (* (log t) a) t) (- (+ (log y) (log z)) (+ t (* (log t) 0.5)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a - 0.5) <= -1e+18) || !((a - 0.5) <= -0.4)) {
tmp = (log(t) * a) - t;
} else {
tmp = (log(y) + log(z)) - (t + (log(t) * 0.5));
}
return tmp;
}
NOTE: x and y 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 (((a - 0.5d0) <= (-1d+18)) .or. (.not. ((a - 0.5d0) <= (-0.4d0)))) then
tmp = (log(t) * a) - t
else
tmp = (log(y) + log(z)) - (t + (log(t) * 0.5d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a - 0.5) <= -1e+18) || !((a - 0.5) <= -0.4)) {
tmp = (Math.log(t) * a) - t;
} else {
tmp = (Math.log(y) + Math.log(z)) - (t + (Math.log(t) * 0.5));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if ((a - 0.5) <= -1e+18) or not ((a - 0.5) <= -0.4): tmp = (math.log(t) * a) - t else: tmp = (math.log(y) + math.log(z)) - (t + (math.log(t) * 0.5)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if ((Float64(a - 0.5) <= -1e+18) || !(Float64(a - 0.5) <= -0.4)) tmp = Float64(Float64(log(t) * a) - t); else tmp = Float64(Float64(log(y) + log(z)) - Float64(t + Float64(log(t) * 0.5))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (((a - 0.5) <= -1e+18) || ~(((a - 0.5) <= -0.4)))
tmp = (log(t) * a) - t;
else
tmp = (log(y) + log(z)) - (t + (log(t) * 0.5));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -1e+18], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], -0.4]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - N[(t + N[(N[Log[t], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -1 \cdot 10^{+18} \lor \neg \left(a - 0.5 \leq -0.4\right):\\
\;\;\;\;\log t \cdot a - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log y + \log z\right) - \left(t + \log t \cdot 0.5\right)\\
\end{array}
\end{array}
if (-.f64 a 1/2) < -1e18 or -0.40000000000000002 < (-.f64 a 1/2) Initial program 99.6%
associate--l+99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 74.7%
Taylor expanded in a around inf 98.8%
*-commutative98.8%
Simplified98.8%
if -1e18 < (-.f64 a 1/2) < -0.40000000000000002Initial program 99.4%
associate-+l-99.4%
+-commutative99.4%
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 64.2%
Taylor expanded in a around 0 64.2%
*-commutative47.5%
Simplified64.2%
Final simplification81.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= (- a 0.5) -1e+18) (not (<= (- a 0.5) -0.4))) (- (* (log t) a) t) (- (+ (log y) (+ (log z) (* (log t) -0.5))) t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a - 0.5) <= -1e+18) || !((a - 0.5) <= -0.4)) {
tmp = (log(t) * a) - t;
} else {
tmp = (log(y) + (log(z) + (log(t) * -0.5))) - t;
}
return tmp;
}
NOTE: x and y 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 (((a - 0.5d0) <= (-1d+18)) .or. (.not. ((a - 0.5d0) <= (-0.4d0)))) then
tmp = (log(t) * a) - t
else
tmp = (log(y) + (log(z) + (log(t) * (-0.5d0)))) - t
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a - 0.5) <= -1e+18) || !((a - 0.5) <= -0.4)) {
tmp = (Math.log(t) * a) - t;
} else {
tmp = (Math.log(y) + (Math.log(z) + (Math.log(t) * -0.5))) - t;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if ((a - 0.5) <= -1e+18) or not ((a - 0.5) <= -0.4): tmp = (math.log(t) * a) - t else: tmp = (math.log(y) + (math.log(z) + (math.log(t) * -0.5))) - t return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if ((Float64(a - 0.5) <= -1e+18) || !(Float64(a - 0.5) <= -0.4)) tmp = Float64(Float64(log(t) * a) - t); else tmp = Float64(Float64(log(y) + Float64(log(z) + Float64(log(t) * -0.5))) - t); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (((a - 0.5) <= -1e+18) || ~(((a - 0.5) <= -0.4)))
tmp = (log(t) * a) - t;
else
tmp = (log(y) + (log(z) + (log(t) * -0.5))) - t;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -1e+18], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], -0.4]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -1 \cdot 10^{+18} \lor \neg \left(a - 0.5 \leq -0.4\right):\\
\;\;\;\;\log t \cdot a - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log y + \left(\log z + \log t \cdot -0.5\right)\right) - t\\
\end{array}
\end{array}
if (-.f64 a 1/2) < -1e18 or -0.40000000000000002 < (-.f64 a 1/2) Initial program 99.6%
associate--l+99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 74.7%
Taylor expanded in a around inf 98.8%
*-commutative98.8%
Simplified98.8%
if -1e18 < (-.f64 a 1/2) < -0.40000000000000002Initial program 99.4%
associate--l+99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 64.3%
Taylor expanded in a around 0 64.3%
*-commutative64.3%
Simplified64.3%
Final simplification81.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 490.0) (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) (- (* (log t) a) t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 490.0) {
tmp = log(y) + (log(z) + (log(t) * (a - 0.5)));
} else {
tmp = (log(t) * a) - t;
}
return tmp;
}
NOTE: x and y 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 <= 490.0d0) then
tmp = log(y) + (log(z) + (log(t) * (a - 0.5d0)))
else
tmp = (log(t) * a) - t
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 490.0) {
tmp = Math.log(y) + (Math.log(z) + (Math.log(t) * (a - 0.5)));
} else {
tmp = (Math.log(t) * a) - t;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if t <= 490.0: tmp = math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5))) else: tmp = (math.log(t) * a) - t return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 490.0) tmp = Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))); else tmp = Float64(Float64(log(t) * a) - t); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= 490.0)
tmp = log(y) + (log(z) + (log(t) * (a - 0.5)));
else
tmp = (log(t) * a) - t;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 490.0], N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 490:\\
\;\;\;\;\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log t \cdot a - t\\
\end{array}
\end{array}
if t < 490Initial program 99.2%
+-commutative99.2%
fma-def99.2%
sub-neg99.2%
metadata-eval99.2%
associate--l+99.2%
Simplified99.2%
Taylor expanded in x around 0 65.2%
Taylor expanded in t around 0 63.7%
if 490 < t Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 73.2%
Taylor expanded in a around inf 97.1%
*-commutative97.1%
Simplified97.1%
Final simplification80.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (+ (+ (log y) (log z)) (- (* (log t) (- a 0.5)) t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return (log(y) + log(z)) + ((log(t) * (a - 0.5)) - t);
}
NOTE: x and y 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(y) + log(z)) + ((log(t) * (a - 0.5d0)) - t)
end function
assert x < y;
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);
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return (math.log(y) + math.log(z)) + ((math.log(t) * (a - 0.5)) - t)
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(Float64(log(y) + log(z)) + Float64(Float64(log(t) * Float64(a - 0.5)) - t)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = (log(y) + log(z)) + ((log(t) * (a - 0.5)) - t);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\left(\log y + \log z\right) + \left(\log t \cdot \left(a - 0.5\right) - t\right)
\end{array}
Initial program 99.5%
associate-+l-99.5%
+-commutative99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-def99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 69.3%
Final simplification69.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 2.15e+14) (- (+ (log (* y z)) (* (log t) (- a 0.5))) t) (- (* (log t) a) t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.15e+14) {
tmp = (log((y * z)) + (log(t) * (a - 0.5))) - t;
} else {
tmp = (log(t) * a) - t;
}
return tmp;
}
NOTE: x and y 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 <= 2.15d+14) then
tmp = (log((y * z)) + (log(t) * (a - 0.5d0))) - t
else
tmp = (log(t) * a) - t
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.15e+14) {
tmp = (Math.log((y * z)) + (Math.log(t) * (a - 0.5))) - t;
} else {
tmp = (Math.log(t) * a) - t;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if t <= 2.15e+14: tmp = (math.log((y * z)) + (math.log(t) * (a - 0.5))) - t else: tmp = (math.log(t) * a) - t return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 2.15e+14) tmp = Float64(Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5))) - t); else tmp = Float64(Float64(log(t) * a) - t); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= 2.15e+14)
tmp = (log((y * z)) + (log(t) * (a - 0.5))) - t;
else
tmp = (log(t) * a) - t;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.15e+14], 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[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.15 \cdot 10^{+14}:\\
\;\;\;\;\left(\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log t \cdot a - t\\
\end{array}
\end{array}
if t < 2.15e14Initial 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-log77.6%
Applied egg-rr77.6%
Taylor expanded in x around 0 51.4%
*-commutative51.4%
Simplified51.4%
if 2.15e14 < t Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 72.2%
Taylor expanded in a around inf 99.7%
*-commutative99.7%
Simplified99.7%
Final simplification74.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= a -0.0076) (not (<= a 4.2))) (- (* (log t) a) t) (+ (log z) (- (log (+ y x)) t))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.0076) || !(a <= 4.2)) {
tmp = (log(t) * a) - t;
} else {
tmp = log(z) + (log((y + x)) - t);
}
return tmp;
}
NOTE: x and y 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 ((a <= (-0.0076d0)) .or. (.not. (a <= 4.2d0))) then
tmp = (log(t) * a) - t
else
tmp = log(z) + (log((y + x)) - t)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.0076) || !(a <= 4.2)) {
tmp = (Math.log(t) * a) - t;
} else {
tmp = Math.log(z) + (Math.log((y + x)) - t);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (a <= -0.0076) or not (a <= 4.2): tmp = (math.log(t) * a) - t else: tmp = math.log(z) + (math.log((y + x)) - t) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.0076) || !(a <= 4.2)) tmp = Float64(Float64(log(t) * a) - t); else tmp = Float64(log(z) + Float64(log(Float64(y + x)) - t)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((a <= -0.0076) || ~((a <= 4.2)))
tmp = (log(t) * a) - t;
else
tmp = log(z) + (log((y + x)) - t);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.0076], N[Not[LessEqual[a, 4.2]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.0076 \lor \neg \left(a \leq 4.2\right):\\
\;\;\;\;\log t \cdot a - t\\
\mathbf{else}:\\
\;\;\;\;\log z + \left(\log \left(y + x\right) - t\right)\\
\end{array}
\end{array}
if a < -0.00759999999999999998 or 4.20000000000000018 < a Initial program 99.6%
associate--l+99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 74.0%
Taylor expanded in a around inf 98.2%
*-commutative98.2%
Simplified98.2%
if -0.00759999999999999998 < a < 4.20000000000000018Initial program 99.4%
associate-+l-99.4%
+-commutative99.4%
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 t around inf 60.1%
Final simplification79.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= a -0.098) (not (<= a 8.5e-40))) (- (* (log t) a) t) (- (log (* y (/ z (sqrt t)))) t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.098) || !(a <= 8.5e-40)) {
tmp = (log(t) * a) - t;
} else {
tmp = log((y * (z / sqrt(t)))) - t;
}
return tmp;
}
NOTE: x and y 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 ((a <= (-0.098d0)) .or. (.not. (a <= 8.5d-40))) then
tmp = (log(t) * a) - t
else
tmp = log((y * (z / sqrt(t)))) - t
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.098) || !(a <= 8.5e-40)) {
tmp = (Math.log(t) * a) - t;
} else {
tmp = Math.log((y * (z / Math.sqrt(t)))) - t;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (a <= -0.098) or not (a <= 8.5e-40): tmp = (math.log(t) * a) - t else: tmp = math.log((y * (z / math.sqrt(t)))) - t return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.098) || !(a <= 8.5e-40)) tmp = Float64(Float64(log(t) * a) - t); else tmp = Float64(log(Float64(y * Float64(z / sqrt(t)))) - t); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((a <= -0.098) || ~((a <= 8.5e-40)))
tmp = (log(t) * a) - t;
else
tmp = log((y * (z / sqrt(t)))) - t;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.098], N[Not[LessEqual[a, 8.5e-40]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(y * N[(z / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.098 \lor \neg \left(a \leq 8.5 \cdot 10^{-40}\right):\\
\;\;\;\;\log t \cdot a - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot \frac{z}{\sqrt{t}}\right) - t\\
\end{array}
\end{array}
if a < -0.098000000000000004 or 8.4999999999999998e-40 < a Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 74.2%
Taylor expanded in a around inf 98.1%
*-commutative98.1%
Simplified98.1%
if -0.098000000000000004 < a < 8.4999999999999998e-40Initial program 99.4%
associate-+l-99.4%
+-commutative99.4%
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%
associate-+r-99.4%
+-commutative99.4%
fma-udef99.4%
associate--r+99.4%
+-commutative99.4%
sum-log72.5%
Applied egg-rr72.5%
Taylor expanded in x around 0 47.7%
*-commutative47.7%
Simplified47.7%
Taylor expanded in a around 0 47.7%
*-commutative47.7%
Simplified47.7%
log-prod64.1%
+-commutative64.1%
associate--l+64.1%
add-log-exp64.1%
exp-to-pow64.1%
pow1/264.1%
Applied egg-rr64.1%
associate-+r-64.1%
+-commutative64.1%
log-prod47.7%
log-div44.0%
associate-/l*46.7%
associate-/r/47.2%
Simplified47.2%
Final simplification73.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 330.0) (+ (log (* y z)) (* (log t) (- a 0.5))) (- (* (log t) a) t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 330.0) {
tmp = log((y * z)) + (log(t) * (a - 0.5));
} else {
tmp = (log(t) * a) - t;
}
return tmp;
}
NOTE: x and y 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 <= 330.0d0) then
tmp = log((y * z)) + (log(t) * (a - 0.5d0))
else
tmp = (log(t) * a) - t
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 330.0) {
tmp = Math.log((y * z)) + (Math.log(t) * (a - 0.5));
} else {
tmp = (Math.log(t) * a) - t;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if t <= 330.0: tmp = math.log((y * z)) + (math.log(t) * (a - 0.5)) else: tmp = (math.log(t) * a) - t return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 330.0) tmp = Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5))); else tmp = Float64(Float64(log(t) * a) - t); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= 330.0)
tmp = log((y * z)) + (log(t) * (a - 0.5));
else
tmp = (log(t) * a) - t;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 330.0], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 330:\\
\;\;\;\;\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\log t \cdot a - t\\
\end{array}
\end{array}
if t < 330Initial program 99.2%
associate-+l-99.2%
+-commutative99.2%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-def99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in x around 0 65.2%
Taylor expanded in t around 0 63.6%
log-prod49.6%
*-commutative49.6%
Simplified49.6%
if 330 < t Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 73.2%
Taylor expanded in a around inf 97.1%
*-commutative97.1%
Simplified97.1%
Final simplification74.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= a -38000000000000.0) (not (<= a 6.3e+16))) (* (log t) a) (- t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -38000000000000.0) || !(a <= 6.3e+16)) {
tmp = log(t) * a;
} else {
tmp = -t;
}
return tmp;
}
NOTE: x and y 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 ((a <= (-38000000000000.0d0)) .or. (.not. (a <= 6.3d+16))) then
tmp = log(t) * a
else
tmp = -t
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -38000000000000.0) || !(a <= 6.3e+16)) {
tmp = Math.log(t) * a;
} else {
tmp = -t;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (a <= -38000000000000.0) or not (a <= 6.3e+16): tmp = math.log(t) * a else: tmp = -t return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if ((a <= -38000000000000.0) || !(a <= 6.3e+16)) tmp = Float64(log(t) * a); else tmp = Float64(-t); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((a <= -38000000000000.0) || ~((a <= 6.3e+16)))
tmp = log(t) * a;
else
tmp = -t;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -38000000000000.0], N[Not[LessEqual[a, 6.3e+16]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], (-t)]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -38000000000000 \lor \neg \left(a \leq 6.3 \cdot 10^{+16}\right):\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if a < -3.8e13 or 6.3e16 < a 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 a around inf 79.2%
*-commutative79.2%
Simplified79.2%
if -3.8e13 < a < 6.3e16Initial program 99.5%
associate-+l-99.5%
+-commutative99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-def99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in t around inf 52.1%
neg-mul-152.1%
Simplified52.1%
Final simplification64.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (- (* (log t) a) t))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return (log(t) * a) - t;
}
NOTE: x and y 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) - t
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(t) * a) - t;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return (math.log(t) * a) - t
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(Float64(log(t) * a) - t) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = (log(t) * a) - t;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\log t \cdot a - t
\end{array}
Initial program 99.5%
associate--l+99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 69.3%
Taylor expanded in a around inf 75.1%
*-commutative75.1%
Simplified75.1%
Final simplification75.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (- t))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return -t;
}
NOTE: x and y 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;
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return -t
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(-t) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = -t;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
-t
\end{array}
Initial program 99.5%
associate-+l-99.5%
+-commutative99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-def99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in t around inf 36.7%
neg-mul-136.7%
Simplified36.7%
Final simplification36.7%
(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 2023308
(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))))