
(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.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
(FPCore (x y z t a)
:precision binary64
(if (<= t 5e-18)
(+ (log y) (+ (log z) (* (log t) (- a 0.5))))
(if (<= t 16500000000000.0)
(+ (log (* z (+ x y))) (* t (- -1.0 (* (log t) (/ (- 0.5 a) t)))))
(fma (+ a -0.5) (log t) (- t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5e-18) {
tmp = log(y) + (log(z) + (log(t) * (a - 0.5)));
} else if (t <= 16500000000000.0) {
tmp = log((z * (x + y))) + (t * (-1.0 - (log(t) * ((0.5 - a) / t))));
} else {
tmp = fma((a + -0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 5e-18) tmp = Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))); elseif (t <= 16500000000000.0) tmp = Float64(log(Float64(z * Float64(x + y))) + Float64(t * Float64(-1.0 - Float64(log(t) * Float64(Float64(0.5 - a) / t))))); else tmp = fma(Float64(a + -0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 5e-18], N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 16500000000000.0], N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(t * N[(-1.0 - N[(N[Log[t], $MachinePrecision] * N[(N[(0.5 - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5 \cdot 10^{-18}:\\
\;\;\;\;\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{elif}\;t \leq 16500000000000:\\
\;\;\;\;\log \left(z \cdot \left(x + y\right)\right) + t \cdot \left(-1 - \log t \cdot \frac{0.5 - a}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a + -0.5, \log t, -t\right)\\
\end{array}
\end{array}
if t < 5.00000000000000036e-18Initial program 99.3%
associate--l+99.3%
+-commutative99.3%
associate-+l+99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 63.2%
Taylor expanded in t around 0 63.2%
if 5.00000000000000036e-18 < t < 1.65e13Initial program 99.3%
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%
associate-+r-99.6%
sum-log99.9%
Applied egg-rr99.9%
Taylor expanded in t around inf 99.7%
mul-1-neg99.7%
unsub-neg99.7%
associate-/l*99.7%
log-rec99.7%
Simplified99.7%
if 1.65e13 < t Initial program 99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
associate--l+99.9%
Simplified99.9%
associate-+r-99.9%
sum-log82.6%
Applied egg-rr82.6%
Taylor expanded in t around inf 99.9%
neg-mul-199.9%
Simplified99.9%
Final simplification83.1%
(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%
associate--l+99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(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.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 72.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (log (* z y)) (+ t (* (log t) 0.5))))
(t_2 (fma (+ a -0.5) (log t) (- t))))
(if (<= a -2.25e+40)
t_2
(if (<= a -3.8e-135)
t_1
(if (<= a -2.35e-189)
(- (+ (log y) (+ (log z) (/ x y))) t)
(if (<= a 0.0021) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((z * y)) - (t + (log(t) * 0.5));
double t_2 = fma((a + -0.5), log(t), -t);
double tmp;
if (a <= -2.25e+40) {
tmp = t_2;
} else if (a <= -3.8e-135) {
tmp = t_1;
} else if (a <= -2.35e-189) {
tmp = (log(y) + (log(z) + (x / y))) - t;
} else if (a <= 0.0021) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(z * y)) - Float64(t + Float64(log(t) * 0.5))) t_2 = fma(Float64(a + -0.5), log(t), Float64(-t)) tmp = 0.0 if (a <= -2.25e+40) tmp = t_2; elseif (a <= -3.8e-135) tmp = t_1; elseif (a <= -2.35e-189) tmp = Float64(Float64(log(y) + Float64(log(z) + Float64(x / y))) - t); elseif (a <= 0.0021) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] - N[(t + N[(N[Log[t], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]}, If[LessEqual[a, -2.25e+40], t$95$2, If[LessEqual[a, -3.8e-135], t$95$1, If[LessEqual[a, -2.35e-189], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[a, 0.0021], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(z \cdot y\right) - \left(t + \log t \cdot 0.5\right)\\
t_2 := \mathsf{fma}\left(a + -0.5, \log t, -t\right)\\
\mathbf{if}\;a \leq -2.25 \cdot 10^{+40}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq -3.8 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -2.35 \cdot 10^{-189}:\\
\;\;\;\;\left(\log y + \left(\log z + \frac{x}{y}\right)\right) - t\\
\mathbf{elif}\;a \leq 0.0021:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -2.25000000000000016e40 or 0.00209999999999999987 < a Initial program 99.8%
+-commutative99.8%
fma-define99.8%
sub-neg99.8%
metadata-eval99.8%
associate--l+99.8%
Simplified99.8%
associate-+r-99.8%
sum-log87.3%
Applied egg-rr87.3%
Taylor expanded in t around inf 99.4%
neg-mul-199.4%
Simplified99.4%
if -2.25000000000000016e40 < a < -3.8000000000000003e-135 or -2.3499999999999998e-189 < a < 0.00209999999999999987Initial program 99.4%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-undefine99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
associate-+r-99.5%
sum-log85.5%
Applied egg-rr85.5%
Taylor expanded in a around 0 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in x around 0 52.8%
if -3.8000000000000003e-135 < a < -2.3499999999999998e-189Initial program 99.8%
associate-+l-99.9%
associate--l+99.7%
sub-neg99.7%
+-commutative99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-undefine99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
metadata-eval99.7%
metadata-eval99.7%
unsub-neg99.7%
Simplified99.7%
associate-+r-99.9%
sum-log48.6%
Applied egg-rr48.6%
Taylor expanded in t around inf 39.5%
Taylor expanded in y around inf 39.0%
associate-+r+39.0%
+-commutative39.0%
mul-1-neg39.0%
log-rec39.0%
remove-double-neg39.0%
associate-+r+39.0%
Simplified39.0%
Final simplification74.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (log (* z y)) (+ t (* (log t) 0.5))))
(t_2 (fma (+ a -0.5) (log t) (- t))))
(if (<= a -2.25e+40)
t_2
(if (<= a -3.8e-135)
t_1
(if (<= a -1.85e-189)
(+ (- (log z) t) (log (+ x y)))
(if (<= a 5.2e-6) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((z * y)) - (t + (log(t) * 0.5));
double t_2 = fma((a + -0.5), log(t), -t);
double tmp;
if (a <= -2.25e+40) {
tmp = t_2;
} else if (a <= -3.8e-135) {
tmp = t_1;
} else if (a <= -1.85e-189) {
tmp = (log(z) - t) + log((x + y));
} else if (a <= 5.2e-6) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(z * y)) - Float64(t + Float64(log(t) * 0.5))) t_2 = fma(Float64(a + -0.5), log(t), Float64(-t)) tmp = 0.0 if (a <= -2.25e+40) tmp = t_2; elseif (a <= -3.8e-135) tmp = t_1; elseif (a <= -1.85e-189) tmp = Float64(Float64(log(z) - t) + log(Float64(x + y))); elseif (a <= 5.2e-6) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] - N[(t + N[(N[Log[t], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]}, If[LessEqual[a, -2.25e+40], t$95$2, If[LessEqual[a, -3.8e-135], t$95$1, If[LessEqual[a, -1.85e-189], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.2e-6], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(z \cdot y\right) - \left(t + \log t \cdot 0.5\right)\\
t_2 := \mathsf{fma}\left(a + -0.5, \log t, -t\right)\\
\mathbf{if}\;a \leq -2.25 \cdot 10^{+40}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq -3.8 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -1.85 \cdot 10^{-189}:\\
\;\;\;\;\left(\log z - t\right) + \log \left(x + y\right)\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -2.25000000000000016e40 or 5.20000000000000019e-6 < a Initial program 99.8%
+-commutative99.8%
fma-define99.8%
sub-neg99.8%
metadata-eval99.8%
associate--l+99.8%
Simplified99.8%
associate-+r-99.8%
sum-log87.3%
Applied egg-rr87.3%
Taylor expanded in t around inf 99.4%
neg-mul-199.4%
Simplified99.4%
if -2.25000000000000016e40 < a < -3.8000000000000003e-135 or -1.8500000000000001e-189 < a < 5.20000000000000019e-6Initial program 99.4%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-undefine99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
associate-+r-99.5%
sum-log85.5%
Applied egg-rr85.5%
Taylor expanded in a around 0 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in x around 0 52.8%
if -3.8000000000000003e-135 < a < -1.8500000000000001e-189Initial program 99.8%
associate-+l-99.9%
associate--l+99.7%
sub-neg99.7%
+-commutative99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-undefine99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
metadata-eval99.7%
metadata-eval99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in t around inf 72.4%
Final simplification76.5%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.85e+14) (- (+ (log (* z (+ x y))) (* (log t) (- a 0.5))) t) (fma (+ a -0.5) (log t) (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.85e+14) {
tmp = (log((z * (x + y))) + (log(t) * (a - 0.5))) - t;
} else {
tmp = fma((a + -0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.85e+14) tmp = Float64(Float64(log(Float64(z * Float64(x + y))) + Float64(log(t) * Float64(a - 0.5))) - t); else tmp = fma(Float64(a + -0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.85e+14], N[(N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.85 \cdot 10^{+14}:\\
\;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a + -0.5, \log t, -t\right)\\
\end{array}
\end{array}
if t < 1.85e14Initial program 99.3%
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%
associate-+r-99.4%
fma-undefine99.4%
associate--r+99.3%
sum-log85.1%
Applied egg-rr85.1%
if 1.85e14 < t Initial program 99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
associate--l+99.9%
Simplified99.9%
associate-+r-99.9%
sum-log82.6%
Applied egg-rr82.6%
Taylor expanded in t around inf 99.9%
neg-mul-199.9%
Simplified99.9%
Final simplification92.2%
(FPCore (x y z t a) :precision binary64 (if (<= t 4.4e+15) (- (+ (log (* z y)) (* (log t) (- a 0.5))) t) (fma (+ a -0.5) (log t) (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 4.4e+15) {
tmp = (log((z * y)) + (log(t) * (a - 0.5))) - t;
} else {
tmp = fma((a + -0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 4.4e+15) tmp = Float64(Float64(log(Float64(z * y)) + Float64(log(t) * Float64(a - 0.5))) - t); else tmp = fma(Float64(a + -0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 4.4e+15], N[(N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.4 \cdot 10^{+15}:\\
\;\;\;\;\left(\log \left(z \cdot y\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a + -0.5, \log t, -t\right)\\
\end{array}
\end{array}
if t < 4.4e15Initial program 99.3%
+-commutative99.3%
fma-define99.3%
sub-neg99.3%
metadata-eval99.3%
associate--l+99.4%
Simplified99.4%
associate-+r-99.3%
sum-log85.0%
Applied egg-rr85.0%
Taylor expanded in x around 0 53.0%
if 4.4e15 < t Initial program 99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
associate--l+99.9%
Simplified99.9%
associate-+r-99.9%
sum-log82.6%
Applied egg-rr82.6%
Taylor expanded in t around inf 99.9%
neg-mul-199.9%
Simplified99.9%
Final simplification75.5%
(FPCore (x y z t a) :precision binary64 (if (<= t 25.0) (+ (log (* z (+ x 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 <= 25.0) {
tmp = log((z * (x + 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 <= 25.0d0) then
tmp = log((z * (x + 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 <= 25.0) {
tmp = Math.log((z * (x + 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 <= 25.0: tmp = math.log((z * (x + 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 <= 25.0) tmp = Float64(log(Float64(z * Float64(x + 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 <= 25.0) tmp = log((z * (x + 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, 25.0], N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $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 25:\\
\;\;\;\;\log \left(z \cdot \left(x + y\right)\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 < 25Initial 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%
sum-log84.4%
Applied egg-rr84.4%
Taylor expanded in t around 0 81.7%
if 25 < t Initial program 99.9%
associate--l+100.0%
+-commutative100.0%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 82.2%
Taylor expanded in a around inf 98.2%
*-commutative98.2%
Simplified98.2%
Final simplification90.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.18e+61) (not (<= a 36000000000.0))) (* a (log t)) (+ (- (log z) t) (log y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.18e+61) || !(a <= 36000000000.0)) {
tmp = a * log(t);
} else {
tmp = (log(z) - t) + log(y);
}
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 <= (-1.18d+61)) .or. (.not. (a <= 36000000000.0d0))) then
tmp = a * log(t)
else
tmp = (log(z) - t) + log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.18e+61) || !(a <= 36000000000.0)) {
tmp = a * Math.log(t);
} else {
tmp = (Math.log(z) - t) + Math.log(y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.18e+61) or not (a <= 36000000000.0): tmp = a * math.log(t) else: tmp = (math.log(z) - t) + math.log(y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.18e+61) || !(a <= 36000000000.0)) tmp = Float64(a * log(t)); else tmp = Float64(Float64(log(z) - t) + log(y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.18e+61) || ~((a <= 36000000000.0))) tmp = a * log(t); else tmp = (log(z) - t) + log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.18e+61], N[Not[LessEqual[a, 36000000000.0]], $MachinePrecision]], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.18 \cdot 10^{+61} \lor \neg \left(a \leq 36000000000\right):\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + \log y\\
\end{array}
\end{array}
if a < -1.18000000000000004e61 or 3.6e10 < a Initial program 99.8%
associate-+l-99.8%
associate--l+99.7%
sub-neg99.7%
+-commutative99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-undefine99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
metadata-eval99.7%
metadata-eval99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in a around inf 77.1%
*-commutative77.1%
Simplified77.1%
if -1.18000000000000004e61 < a < 3.6e10Initial program 99.5%
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%
associate-+r-99.6%
sum-log81.9%
Applied egg-rr81.9%
Taylor expanded in t around inf 48.9%
Taylor expanded in y around inf 47.2%
+-commutative47.2%
associate--l+47.2%
mul-1-neg47.2%
log-rec47.2%
remove-double-neg47.2%
Simplified47.2%
Final simplification60.7%
(FPCore (x y z t a) :precision binary64 (fma (+ a -0.5) (log t) (- t)))
double code(double x, double y, double z, double t, double a) {
return fma((a + -0.5), log(t), -t);
}
function code(x, y, z, t, a) return fma(Float64(a + -0.5), log(t), Float64(-t)) end
code[x_, y_, z_, t_, a_] := N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a + -0.5, \log t, -t\right)
\end{array}
Initial program 99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
associate--l+99.6%
Simplified99.6%
associate-+r-99.6%
sum-log83.9%
Applied egg-rr83.9%
Taylor expanded in t around inf 76.7%
neg-mul-176.7%
Simplified76.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 4.8e+76) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 4.8e+76) {
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 <= 4.8d+76) 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 <= 4.8e+76) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 4.8e+76: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 4.8e+76) 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 <= 4.8e+76) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 4.8e+76], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.8 \cdot 10^{+76}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 4.8e76Initial 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 50.0%
*-commutative50.0%
Simplified50.0%
if 4.8e76 < t Initial program 100.0%
associate-+l-100.0%
associate--l+100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-undefine100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in t around inf 80.8%
neg-mul-180.8%
Simplified80.8%
Final simplification62.7%
(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 38.6%
neg-mul-138.6%
Simplified38.6%
(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 2024087
(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))))