
(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 13 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 z) t) (fma (+ a -0.5) (log t) (log (+ x y)))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + fma((a + -0.5), log(t), log((x + y)));
}
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + fma(Float64(a + -0.5), log(t), log(Float64(x + y)))) end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \mathsf{fma}\left(a + -0.5, \log t, \log \left(x + y\right)\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log z) (log (+ x y)))))
(if (or (<= t_1 -750.0) (not (<= t_1 690.0)))
(+ (- (log z) t) (* a (log t)))
(+ (log (* z (+ x y))) (- (* (+ a -0.5) (log t)) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(z) + log((x + y));
double tmp;
if ((t_1 <= -750.0) || !(t_1 <= 690.0)) {
tmp = (log(z) - t) + (a * log(t));
} else {
tmp = log((z * (x + y))) + (((a + -0.5) * 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((x + y))
if ((t_1 <= (-750.0d0)) .or. (.not. (t_1 <= 690.0d0))) then
tmp = (log(z) - t) + (a * log(t))
else
tmp = log((z * (x + y))) + (((a + (-0.5d0)) * 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((x + y));
double tmp;
if ((t_1 <= -750.0) || !(t_1 <= 690.0)) {
tmp = (Math.log(z) - t) + (a * Math.log(t));
} else {
tmp = Math.log((z * (x + y))) + (((a + -0.5) * Math.log(t)) - t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(z) + math.log((x + y)) tmp = 0 if (t_1 <= -750.0) or not (t_1 <= 690.0): tmp = (math.log(z) - t) + (a * math.log(t)) else: tmp = math.log((z * (x + y))) + (((a + -0.5) * math.log(t)) - t) return tmp
function code(x, y, z, t, a) t_1 = Float64(log(z) + log(Float64(x + y))) tmp = 0.0 if ((t_1 <= -750.0) || !(t_1 <= 690.0)) tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); else tmp = Float64(log(Float64(z * Float64(x + y))) + Float64(Float64(Float64(a + -0.5) * log(t)) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(z) + log((x + y)); tmp = 0.0; if ((t_1 <= -750.0) || ~((t_1 <= 690.0))) tmp = (log(z) - t) + (a * log(t)); else tmp = log((z * (x + y))) + (((a + -0.5) * 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[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -750.0], N[Not[LessEqual[t$95$1, 690.0]], $MachinePrecision]], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log z + \log \left(x + y\right)\\
\mathbf{if}\;t\_1 \leq -750 \lor \neg \left(t\_1 \leq 690\right):\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\log \left(z \cdot \left(x + y\right)\right) + \left(\left(a + -0.5\right) \cdot \log t - t\right)\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -750 or 690 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.8%
associate--l+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
fma-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 67.8%
Taylor expanded in a around inf 83.1%
*-commutative83.1%
Simplified83.1%
if -750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 690Initial program 99.6%
remove-double-neg99.6%
associate--l+99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
metadata-eval99.6%
sub-neg99.6%
associate-+r-99.6%
associate-+l-99.6%
sum-log99.5%
sub-neg99.5%
metadata-eval99.5%
*-commutative99.5%
Applied egg-rr99.5%
Final simplification95.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log z) (log (+ x y)))))
(if (or (<= t_1 -750.0) (not (<= t_1 690.0)))
(+ (- (log z) t) (* a (log t)))
(+ (log (* z y)) (- (* (+ a -0.5) (log t)) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(z) + log((x + y));
double tmp;
if ((t_1 <= -750.0) || !(t_1 <= 690.0)) {
tmp = (log(z) - t) + (a * log(t));
} else {
tmp = log((z * y)) + (((a + -0.5) * 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((x + y))
if ((t_1 <= (-750.0d0)) .or. (.not. (t_1 <= 690.0d0))) then
tmp = (log(z) - t) + (a * log(t))
else
tmp = log((z * y)) + (((a + (-0.5d0)) * 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((x + y));
double tmp;
if ((t_1 <= -750.0) || !(t_1 <= 690.0)) {
tmp = (Math.log(z) - t) + (a * Math.log(t));
} else {
tmp = Math.log((z * y)) + (((a + -0.5) * Math.log(t)) - t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(z) + math.log((x + y)) tmp = 0 if (t_1 <= -750.0) or not (t_1 <= 690.0): tmp = (math.log(z) - t) + (a * math.log(t)) else: tmp = math.log((z * y)) + (((a + -0.5) * math.log(t)) - t) return tmp
function code(x, y, z, t, a) t_1 = Float64(log(z) + log(Float64(x + y))) tmp = 0.0 if ((t_1 <= -750.0) || !(t_1 <= 690.0)) tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); else tmp = Float64(log(Float64(z * y)) + Float64(Float64(Float64(a + -0.5) * log(t)) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(z) + log((x + y)); tmp = 0.0; if ((t_1 <= -750.0) || ~((t_1 <= 690.0))) tmp = (log(z) - t) + (a * log(t)); else tmp = log((z * y)) + (((a + -0.5) * 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[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -750.0], N[Not[LessEqual[t$95$1, 690.0]], $MachinePrecision]], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log z + \log \left(x + y\right)\\
\mathbf{if}\;t\_1 \leq -750 \lor \neg \left(t\_1 \leq 690\right):\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\log \left(z \cdot y\right) + \left(\left(a + -0.5\right) \cdot \log t - t\right)\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -750 or 690 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.8%
associate--l+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
fma-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 67.8%
Taylor expanded in a around inf 83.1%
*-commutative83.1%
Simplified83.1%
if -750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 690Initial program 99.6%
remove-double-neg99.6%
associate--l+99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
metadata-eval99.6%
sub-neg99.6%
associate-+r-99.6%
associate-+l-99.6%
sum-log99.5%
sub-neg99.5%
metadata-eval99.5%
*-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 70.7%
*-commutative70.7%
Simplified70.7%
Final simplification73.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 420.0) (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) (+ (- (log z) t) (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 420.0) {
tmp = log(y) + (log(z) + (log(t) * (a - 0.5)));
} else {
tmp = (log(z) - t) + (a * 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 (t <= 420.0d0) then
tmp = log(y) + (log(z) + (log(t) * (a - 0.5d0)))
else
tmp = (log(z) - t) + (a * 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 (t <= 420.0) {
tmp = Math.log(y) + (Math.log(z) + (Math.log(t) * (a - 0.5)));
} else {
tmp = (Math.log(z) - t) + (a * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 420.0: tmp = math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5))) else: tmp = (math.log(z) - t) + (a * math.log(t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 420.0) tmp = Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))); else tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 420.0) tmp = log(y) + (log(z) + (log(t) * (a - 0.5))); else tmp = (log(z) - t) + (a * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 420.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[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 420:\\
\;\;\;\;\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\end{array}
\end{array}
if t < 420Initial program 99.4%
associate--l+99.4%
+-commutative99.4%
associate-+l+99.4%
+-commutative99.4%
fma-define99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 67.7%
Taylor expanded in t around 0 67.0%
if 420 < t Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 78.7%
Taylor expanded in a around inf 98.8%
*-commutative98.8%
Simplified98.8%
Final simplification81.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.42) (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) (+ (+ (log z) (log y)) (- (* a (log t)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.42) {
tmp = log(y) + (log(z) + (log(t) * (a - 0.5)));
} else {
tmp = (log(z) + log(y)) + ((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.42d0) then
tmp = log(y) + (log(z) + (log(t) * (a - 0.5d0)))
else
tmp = (log(z) + log(y)) + ((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.42) {
tmp = Math.log(y) + (Math.log(z) + (Math.log(t) * (a - 0.5)));
} else {
tmp = (Math.log(z) + Math.log(y)) + ((a * Math.log(t)) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.42: tmp = math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5))) else: tmp = (math.log(z) + math.log(y)) + ((a * math.log(t)) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.42) tmp = Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))); else tmp = Float64(Float64(log(z) + log(y)) + 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.42) tmp = log(y) + (log(z) + (log(t) * (a - 0.5))); else tmp = (log(z) + log(y)) + ((a * log(t)) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.42], 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[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.42:\\
\;\;\;\;\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log z + \log y\right) + \left(a \cdot \log t - t\right)\\
\end{array}
\end{array}
if t < 0.419999999999999984Initial program 99.4%
associate--l+99.4%
+-commutative99.4%
associate-+l+99.4%
+-commutative99.4%
fma-define99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 67.0%
Taylor expanded in t around 0 66.8%
if 0.419999999999999984 < 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 x around 0 79.2%
Taylor expanded in a around inf 78.2%
mul-1-neg78.2%
*-commutative78.2%
distribute-rgt-neg-in78.2%
Simplified78.2%
Final simplification72.2%
(FPCore (x y z t a) :precision binary64 (+ (+ (- (log z) t) (log (+ x y))) (* (+ a -0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log(z) - t) + log((x + y))) + ((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(z) - t) + log((x + y))) + ((a + (-0.5d0)) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log(z) - t) + Math.log((x + y))) + ((a + -0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log(z) - t) + math.log((x + y))) + ((a + -0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(z) - t) + log(Float64(x + y))) + Float64(Float64(a + -0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log(z) - t) + log((x + y))) + ((a + -0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log z - t\right) + \log \left(x + y\right)\right) + \left(a + -0.5\right) \cdot \log t
\end{array}
Initial program 99.6%
remove-double-neg99.6%
associate--l+99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (+ (log y) (+ (- (log z) t) (* (+ a -0.5) (log t)))))
double code(double x, double y, double z, double t, double a) {
return log(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(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(y) + ((Math.log(z) - t) + ((a + -0.5) * Math.log(t)));
}
def code(x, y, z, t, a): return math.log(y) + ((math.log(z) - t) + ((a + -0.5) * math.log(t)))
function code(x, y, z, t, a) return Float64(log(y) + Float64(Float64(log(z) - t) + Float64(Float64(a + -0.5) * log(t)))) end
function tmp = code(x, y, z, t, a) tmp = log(y) + ((log(z) - t) + ((a + -0.5) * log(t))); end
code[x_, y_, z_, t_, a_] := N[(N[Log[y], $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 y + \left(\left(\log z - t\right) + \left(a + -0.5\right) \cdot \log t\right)
\end{array}
Initial program 99.6%
remove-double-neg99.6%
associate--l+99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 72.8%
associate--l+72.8%
sub-neg72.8%
+-commutative72.8%
associate-+r+72.8%
sub-neg72.8%
metadata-eval72.8%
sub-neg72.8%
Simplified72.8%
Final simplification72.8%
(FPCore (x y z t a) :precision binary64 (+ (- (log z) t) (+ (log y) (* (log t) (- a 0.5)))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + (log(y) + (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(z) - t) + (log(y) + (log(t) * (a - 0.5d0)))
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(z) - t) + (Math.log(y) + (Math.log(t) * (a - 0.5)));
}
def code(x, y, z, t, a): return (math.log(z) - t) + (math.log(y) + (math.log(t) * (a - 0.5)))
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + Float64(log(y) + Float64(log(t) * Float64(a - 0.5)))) end
function tmp = code(x, y, z, t, a) tmp = (log(z) - t) + (log(y) + (log(t) * (a - 0.5))); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \left(\log y + \log t \cdot \left(a - 0.5\right)\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 72.8%
Final simplification72.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 13.5) (+ (log (* z y)) (* (log t) (- a 0.5))) (+ (- (log z) t) (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 13.5) {
tmp = log((z * y)) + (log(t) * (a - 0.5));
} else {
tmp = (log(z) - t) + (a * 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 (t <= 13.5d0) then
tmp = log((z * y)) + (log(t) * (a - 0.5d0))
else
tmp = (log(z) - t) + (a * 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 (t <= 13.5) {
tmp = Math.log((z * y)) + (Math.log(t) * (a - 0.5));
} else {
tmp = (Math.log(z) - t) + (a * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 13.5: tmp = math.log((z * y)) + (math.log(t) * (a - 0.5)) else: tmp = (math.log(z) - t) + (a * math.log(t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 13.5) tmp = Float64(log(Float64(z * y)) + Float64(log(t) * Float64(a - 0.5))); else tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 13.5) tmp = log((z * y)) + (log(t) * (a - 0.5)); else tmp = (log(z) - t) + (a * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 13.5], N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 13.5:\\
\;\;\;\;\log \left(z \cdot y\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\end{array}
\end{array}
if t < 13.5Initial program 99.4%
remove-double-neg99.4%
associate--l+99.4%
remove-double-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
metadata-eval99.4%
sub-neg99.4%
associate-+r-99.4%
associate-+l-99.4%
sum-log79.5%
sub-neg79.5%
metadata-eval79.5%
*-commutative79.5%
Applied egg-rr79.5%
Taylor expanded in x around 0 55.3%
*-commutative55.3%
Simplified55.3%
Taylor expanded in t around 0 54.8%
mul-1-neg54.8%
sub-neg54.8%
metadata-eval54.8%
distribute-rgt-neg-in54.8%
neg-sub054.8%
+-commutative54.8%
associate--r+54.8%
metadata-eval54.8%
Simplified54.8%
if 13.5 < t Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 78.7%
Taylor expanded in a around inf 98.8%
*-commutative98.8%
Simplified98.8%
Final simplification75.2%
(FPCore (x y z t a) :precision binary64 (if (<= t 60000000000000.0) (+ (log (+ x y)) (* a (log t))) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 60000000000000.0) {
tmp = log((x + y)) + (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 <= 60000000000000.0d0) then
tmp = log((x + y)) + (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 <= 60000000000000.0) {
tmp = Math.log((x + y)) + (a * Math.log(t));
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 60000000000000.0: tmp = math.log((x + y)) + (a * math.log(t)) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 60000000000000.0) tmp = Float64(log(Float64(x + y)) + 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 <= 60000000000000.0) tmp = log((x + y)) + (a * log(t)); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 60000000000000.0], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 60000000000000:\\
\;\;\;\;\log \left(x + y\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 6e13Initial program 99.4%
associate-+l-99.4%
associate--l+99.4%
sub-neg99.4%
+-commutative99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
fma-undefine99.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 70.6%
mul-1-neg70.6%
unsub-neg70.6%
associate-/l*70.5%
log-rec70.5%
Simplified70.5%
+-commutative70.5%
*-un-lft-identity70.5%
fma-define70.5%
cancel-sign-sub70.5%
+-commutative70.5%
Applied egg-rr70.5%
fma-undefine70.5%
*-lft-identity70.5%
Simplified70.5%
Taylor expanded in a around inf 63.4%
*-commutative63.4%
Simplified63.4%
if 6e13 < 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 79.1%
neg-mul-179.1%
Simplified79.1%
Final simplification70.3%
(FPCore (x y z t a) :precision binary64 (+ (- (log z) t) (* a (log t))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + (a * 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(z) - t) + (a * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(z) - t) + (a * Math.log(t));
}
def code(x, y, z, t, a): return (math.log(z) - t) + (a * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + Float64(a * log(t))) end
function tmp = code(x, y, z, t, a) tmp = (log(z) - t) + (a * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + a \cdot \log t
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 72.8%
Taylor expanded in a around inf 80.0%
*-commutative80.0%
Simplified80.0%
Final simplification80.0%
(FPCore (x y z t a) :precision binary64 (if (<= t 59000000000000.0) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 59000000000000.0) {
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 <= 59000000000000.0d0) 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 <= 59000000000000.0) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 59000000000000.0: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 59000000000000.0) 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 <= 59000000000000.0) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 59000000000000.0], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 59000000000000:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 5.9e13Initial program 99.4%
associate-+l-99.4%
associate--l+99.4%
sub-neg99.4%
+-commutative99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
fma-undefine99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
metadata-eval99.4%
metadata-eval99.4%
unsub-neg99.4%
Simplified99.4%
Taylor expanded in a around inf 59.1%
*-commutative59.1%
Simplified59.1%
if 5.9e13 < 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 79.1%
neg-mul-179.1%
Simplified79.1%
Final simplification67.9%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.6%
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 36.9%
neg-mul-136.9%
Simplified36.9%
Final simplification36.9%
(FPCore (x y z t a) :precision binary64 (+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t)))))
double code(double x, double y, double z, double t, double a) {
return log((x + y)) + ((log(z) - t) + ((a - 0.5) * log(t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = log((x + y)) + ((log(z) - t) + ((a - 0.5d0) * log(t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return Math.log((x + y)) + ((Math.log(z) - t) + ((a - 0.5) * Math.log(t)));
}
def code(x, y, z, t, a): return math.log((x + y)) + ((math.log(z) - t) + ((a - 0.5) * math.log(t)))
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + Float64(Float64(log(z) - t) + Float64(Float64(a - 0.5) * log(t)))) end
function tmp = code(x, y, z, t, a) tmp = log((x + y)) + ((log(z) - t) + ((a - 0.5) * log(t))); end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \left(\left(\log z - t\right) + \left(a - 0.5\right) \cdot \log t\right)
\end{array}
herbie shell --seed 2024130
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:alt
(+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))