
(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 (+ (log z) (log y)))) (if (<= t 0.44) (+ t_1 (* (log t) (- a 0.5))) (- (+ t_1 (* a (log t))) t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(z) + log(y);
double tmp;
if (t <= 0.44) {
tmp = t_1 + (log(t) * (a - 0.5));
} else {
tmp = (t_1 + (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) :: t_1
real(8) :: tmp
t_1 = log(z) + log(y)
if (t <= 0.44d0) then
tmp = t_1 + (log(t) * (a - 0.5d0))
else
tmp = (t_1 + (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 t_1 = Math.log(z) + Math.log(y);
double tmp;
if (t <= 0.44) {
tmp = t_1 + (Math.log(t) * (a - 0.5));
} else {
tmp = (t_1 + (a * Math.log(t))) - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(z) + math.log(y) tmp = 0 if t <= 0.44: tmp = t_1 + (math.log(t) * (a - 0.5)) else: tmp = (t_1 + (a * math.log(t))) - t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(z) + log(y)) tmp = 0.0 if (t <= 0.44) tmp = Float64(t_1 + Float64(log(t) * Float64(a - 0.5))); else tmp = Float64(Float64(t_1 + Float64(a * log(t))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(z) + log(y); tmp = 0.0; if (t <= 0.44) tmp = t_1 + (log(t) * (a - 0.5)); else tmp = (t_1 + (a * log(t))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 0.44], N[(t$95$1 + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log z + \log y\\
\mathbf{if}\;t \leq 0.44:\\
\;\;\;\;t\_1 + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + a \cdot \log t\right) - t\\
\end{array}
\end{array}
if t < 0.440000000000000002Initial program 99.2%
Taylor expanded in t around inf 99.1%
Taylor expanded in x around 0 70.7%
+-commutative70.7%
Simplified70.7%
Taylor expanded in t around 0 70.7%
if 0.440000000000000002 < t Initial program 99.9%
associate-+l-99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-undefine99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
associate-+r-99.9%
fma-undefine99.9%
associate--r+99.9%
sum-log70.7%
Applied egg-rr70.7%
Taylor expanded in y around inf 72.1%
mul-1-neg72.1%
log-rec72.1%
remove-double-neg72.1%
Simplified72.1%
Taylor expanded in a around inf 72.0%
mul-1-neg72.0%
*-commutative72.0%
distribute-lft-neg-in72.0%
Simplified72.0%
Final simplification71.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (log t) (- a 0.5)))) (if (<= t 280.0) (+ (+ (log z) (log y)) t_1) (- t_1 t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * (a - 0.5);
double tmp;
if (t <= 280.0) {
tmp = (log(z) + log(y)) + t_1;
} else {
tmp = t_1 - 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) :: t_1
real(8) :: tmp
t_1 = log(t) * (a - 0.5d0)
if (t <= 280.0d0) then
tmp = (log(z) + log(y)) + t_1
else
tmp = t_1 - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = Math.log(t) * (a - 0.5);
double tmp;
if (t <= 280.0) {
tmp = (Math.log(z) + Math.log(y)) + t_1;
} else {
tmp = t_1 - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(t) * (a - 0.5) tmp = 0 if t <= 280.0: tmp = (math.log(z) + math.log(y)) + t_1 else: tmp = t_1 - t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(t) * Float64(a - 0.5)) tmp = 0.0 if (t <= 280.0) tmp = Float64(Float64(log(z) + log(y)) + t_1); else tmp = Float64(t_1 - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(t) * (a - 0.5); tmp = 0.0; if (t <= 280.0) tmp = (log(z) + log(y)) + t_1; else tmp = t_1 - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 280.0], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$1 - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t \leq 280:\\
\;\;\;\;\left(\log z + \log y\right) + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t\\
\end{array}
\end{array}
if t < 280Initial program 99.2%
Taylor expanded in t around inf 99.1%
Taylor expanded in x around 0 70.7%
+-commutative70.7%
Simplified70.7%
Taylor expanded in t around 0 70.7%
if 280 < t Initial program 99.9%
Taylor expanded in t around inf 99.9%
Taylor expanded in t around inf 99.3%
mul-1-neg99.3%
Simplified99.3%
Final simplification86.1%
(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(Float64(log(z) + log(y)) + 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[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log z + \log y\right) + \log t \cdot \left(a + -0.5\right)\right) - t
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 71.5%
associate-+r+71.5%
sub-neg71.5%
metadata-eval71.5%
Simplified71.5%
Final simplification71.5%
(FPCore (x y z t a) :precision binary64 (- (+ (log y) (+ (log z) (* (- a 0.5) (log t)))) t))
double code(double x, double y, double z, double t, double a) {
return (log(y) + (log(z) + ((a - 0.5) * 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 = (log(y) + (log(z) + ((a - 0.5d0) * log(t)))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(y) + (Math.log(z) + ((a - 0.5) * Math.log(t)))) - t;
}
def code(x, y, z, t, a): return (math.log(y) + (math.log(z) + ((a - 0.5) * math.log(t)))) - t
function code(x, y, z, t, a) return Float64(Float64(log(y) + Float64(log(z) + Float64(Float64(a - 0.5) * log(t)))) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(y) + (log(z) + ((a - 0.5) * log(t)))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y + \left(\log z + \left(a - 0.5\right) \cdot \log t\right)\right) - t
\end{array}
Initial program 99.6%
add-exp-log53.7%
Applied egg-rr53.7%
Taylor expanded in x around 0 71.5%
Final simplification71.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.85e-30) (not (<= a 1.9e-95))) (- (* (log t) (- a 0.5)) t) (- (log (* y z)) (+ t (* 0.5 (log t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.85e-30) || !(a <= 1.9e-95)) {
tmp = (log(t) * (a - 0.5)) - t;
} else {
tmp = log((y * z)) - (t + (0.5 * log(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 <= (-2.85d-30)) .or. (.not. (a <= 1.9d-95))) then
tmp = (log(t) * (a - 0.5d0)) - t
else
tmp = log((y * z)) - (t + (0.5d0 * log(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 <= -2.85e-30) || !(a <= 1.9e-95)) {
tmp = (Math.log(t) * (a - 0.5)) - t;
} else {
tmp = Math.log((y * z)) - (t + (0.5 * Math.log(t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.85e-30) or not (a <= 1.9e-95): tmp = (math.log(t) * (a - 0.5)) - t else: tmp = math.log((y * z)) - (t + (0.5 * math.log(t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.85e-30) || !(a <= 1.9e-95)) tmp = Float64(Float64(log(t) * Float64(a - 0.5)) - t); else tmp = Float64(log(Float64(y * z)) - Float64(t + Float64(0.5 * log(t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2.85e-30) || ~((a <= 1.9e-95))) tmp = (log(t) * (a - 0.5)) - t; else tmp = log((y * z)) - (t + (0.5 * log(t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.85e-30], N[Not[LessEqual[a, 1.9e-95]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] - N[(t + N[(0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.85 \cdot 10^{-30} \lor \neg \left(a \leq 1.9 \cdot 10^{-95}\right):\\
\;\;\;\;\log t \cdot \left(a - 0.5\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot z\right) - \left(t + 0.5 \cdot \log t\right)\\
\end{array}
\end{array}
if a < -2.84999999999999989e-30 or 1.8999999999999999e-95 < a Initial program 99.7%
Taylor expanded in t around inf 99.7%
Taylor expanded in t around inf 97.3%
mul-1-neg97.3%
Simplified97.3%
if -2.84999999999999989e-30 < a < 1.8999999999999999e-95Initial program 99.3%
associate-+l-99.3%
associate--l+99.3%
sub-neg99.3%
+-commutative99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
fma-undefine99.3%
sub-neg99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
associate-+r-99.3%
fma-undefine99.3%
associate--r+99.4%
sum-log78.2%
Applied egg-rr78.2%
Taylor expanded in a around 0 78.2%
Taylor expanded in x around 0 51.5%
Final simplification80.0%
(FPCore (x y z t a) :precision binary64 (if (<= t 8.5e+14) (+ (log (* (+ x y) z)) (- (* (log t) (+ a -0.5)) t)) (- (* (log t) (- a 0.5)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 8.5e+14) {
tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t);
} else {
tmp = (log(t) * (a - 0.5)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 8.5d+14) then
tmp = log(((x + y) * z)) + ((log(t) * (a + (-0.5d0))) - t)
else
tmp = (log(t) * (a - 0.5d0)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 8.5e+14) {
tmp = Math.log(((x + y) * z)) + ((Math.log(t) * (a + -0.5)) - t);
} else {
tmp = (Math.log(t) * (a - 0.5)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 8.5e+14: tmp = math.log(((x + y) * z)) + ((math.log(t) * (a + -0.5)) - t) else: tmp = (math.log(t) * (a - 0.5)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 8.5e+14) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(Float64(log(t) * Float64(a + -0.5)) - t)); else tmp = Float64(Float64(log(t) * Float64(a - 0.5)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 8.5e+14) tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t); else tmp = (log(t) * (a - 0.5)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 8.5e+14], N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8.5 \cdot 10^{+14}:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \left(\log t \cdot \left(a + -0.5\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\log t \cdot \left(a - 0.5\right) - t\\
\end{array}
\end{array}
if t < 8.5e14Initial program 99.2%
associate--l+99.2%
+-commutative99.2%
associate-+l+99.2%
+-commutative99.2%
fma-define99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
+-commutative99.2%
fma-undefine99.2%
metadata-eval99.2%
sub-neg99.2%
associate-+r+99.2%
associate--l+99.2%
+-commutative99.2%
associate-+l-99.2%
sum-log83.7%
sub-neg83.7%
metadata-eval83.7%
*-commutative83.7%
Applied egg-rr83.7%
if 8.5e14 < t Initial program 99.9%
Taylor expanded in t around inf 99.9%
Taylor expanded in t around inf 99.8%
mul-1-neg99.8%
Simplified99.8%
Final simplification91.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (log t) (- a 0.5)))) (if (<= t 8.5e+14) (- (+ (log (* y z)) t_1) t) (- t_1 t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * (a - 0.5);
double tmp;
if (t <= 8.5e+14) {
tmp = (log((y * z)) + t_1) - t;
} else {
tmp = t_1 - 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) :: t_1
real(8) :: tmp
t_1 = log(t) * (a - 0.5d0)
if (t <= 8.5d+14) then
tmp = (log((y * z)) + t_1) - t
else
tmp = t_1 - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = Math.log(t) * (a - 0.5);
double tmp;
if (t <= 8.5e+14) {
tmp = (Math.log((y * z)) + t_1) - t;
} else {
tmp = t_1 - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(t) * (a - 0.5) tmp = 0 if t <= 8.5e+14: tmp = (math.log((y * z)) + t_1) - t else: tmp = t_1 - t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(t) * Float64(a - 0.5)) tmp = 0.0 if (t <= 8.5e+14) tmp = Float64(Float64(log(Float64(y * z)) + t_1) - t); else tmp = Float64(t_1 - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(t) * (a - 0.5); tmp = 0.0; if (t <= 8.5e+14) tmp = (log((y * z)) + t_1) - t; else tmp = t_1 - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 8.5e+14], N[(N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] - t), $MachinePrecision], N[(t$95$1 - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t \leq 8.5 \cdot 10^{+14}:\\
\;\;\;\;\left(\log \left(y \cdot z\right) + t\_1\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t\\
\end{array}
\end{array}
if t < 8.5e14Initial program 99.2%
associate-+l-99.2%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-undefine99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
associate-+r-99.2%
fma-undefine99.2%
associate--r+99.2%
sum-log83.7%
Applied egg-rr83.7%
Taylor expanded in x around 0 58.7%
*-commutative58.7%
Simplified58.7%
if 8.5e14 < t Initial program 99.9%
Taylor expanded in t around inf 99.9%
Taylor expanded in t around inf 99.8%
mul-1-neg99.8%
Simplified99.8%
Final simplification79.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.55e+40) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.55e+40) {
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 <= 1.55d+40) 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 <= 1.55e+40) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.55e+40: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.55e+40) 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 <= 1.55e+40) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.55e+40], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.55 \cdot 10^{+40}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 1.5499999999999999e40Initial program 99.2%
associate-+l-99.2%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-undefine99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in a around inf 57.5%
*-commutative57.5%
Simplified57.5%
if 1.5499999999999999e40 < t Initial program 99.9%
associate-+l-99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-undefine99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 81.6%
neg-mul-181.6%
Simplified81.6%
Final simplification68.8%
(FPCore (x y z t a) :precision binary64 (- (* (log t) (- a 0.5)) t))
double code(double x, double y, double z, double t, double a) {
return (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(t) * (a - 0.5d0)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(t) * (a - 0.5)) - t;
}
def code(x, y, z, t, a): return (math.log(t) * (a - 0.5)) - t
function code(x, y, z, t, a) return Float64(Float64(log(t) * Float64(a - 0.5)) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(t) * (a - 0.5)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log t \cdot \left(a - 0.5\right) - t
\end{array}
Initial program 99.6%
Taylor expanded in t around inf 99.5%
Taylor expanded in t around inf 81.4%
mul-1-neg81.4%
Simplified81.4%
Final simplification81.4%
(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%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in t around inf 41.6%
neg-mul-141.6%
Simplified41.6%
(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 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%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in t around inf 41.6%
neg-mul-141.6%
Simplified41.6%
add-sqr-sqrt0.0%
sqrt-unprod2.4%
sqr-neg2.4%
sqrt-unprod2.2%
add-sqr-sqrt2.2%
add-log-exp2.1%
*-un-lft-identity2.1%
log-prod2.1%
metadata-eval2.1%
add-log-exp2.2%
Applied egg-rr2.2%
+-lft-identity2.2%
Simplified2.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 2024174
(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))))