
(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 16 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 (- (fma (+ a -0.5) (log t) (+ (log (+ x y)) (log z))) t))
double code(double x, double y, double z, double t, double a) {
return fma((a + -0.5), log(t), (log((x + y)) + log(z))) - t;
}
function code(x, y, z, t, a) return Float64(fma(Float64(a + -0.5), log(t), Float64(log(Float64(x + y)) + log(z))) - t) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a + -0.5, \log t, \log \left(x + y\right) + \log z\right) - t
\end{array}
Initial program 99.5%
+-commutative99.5%
associate-+r-99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t a) :precision binary64 (+ (log (+ x y)) (- (log z) (fma (log t) (- 0.5 a) t))))
double code(double x, double y, double z, double t, double a) {
return log((x + y)) + (log(z) - fma(log(t), (0.5 - a), t));
}
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + Float64(log(z) - fma(log(t), Float64(0.5 - a), t))) end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * N[(0.5 - a), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, 0.5 - a, t\right)\right)
\end{array}
Initial program 99.5%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-udef99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.4e-6) (+ (log z) (+ (log (+ x y)) (* (log t) (- a 0.5)))) (fma (log t) a (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.4e-6) {
tmp = log(z) + (log((x + y)) + (log(t) * (a - 0.5)));
} else {
tmp = fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.4e-6) tmp = Float64(log(z) + Float64(log(Float64(x + y)) + Float64(log(t) * Float64(a - 0.5)))); else tmp = fma(log(t), a, Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.4e-6], N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.4 \cdot 10^{-6}:\\
\;\;\;\;\log z + \left(\log \left(x + y\right) + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if t < 1.39999999999999994e-6Initial program 99.1%
Taylor expanded in t around 0 98.1%
if 1.39999999999999994e-6 < t Initial program 99.9%
Taylor expanded in x around 0 75.2%
Taylor expanded in a around inf 98.0%
*-commutative98.0%
Simplified98.0%
fma-neg98.0%
Applied egg-rr98.0%
Final simplification98.0%
(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.5%
Final simplification99.5%
(FPCore (x y z t a)
:precision binary64
(if (<= a -0.28)
(- (* a (log t)) t)
(if (<= a 5e-31)
(- (+ (log y) (log (* z (pow t -0.5)))) t)
(fma (log t) a (- t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -0.28) {
tmp = (a * log(t)) - t;
} else if (a <= 5e-31) {
tmp = (log(y) + log((z * pow(t, -0.5)))) - t;
} else {
tmp = fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -0.28) tmp = Float64(Float64(a * log(t)) - t); elseif (a <= 5e-31) tmp = Float64(Float64(log(y) + log(Float64(z * (t ^ -0.5)))) - t); else tmp = fma(log(t), a, Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -0.28], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[a, 5e-31], N[(N[(N[Log[y], $MachinePrecision] + N[Log[N[(z * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.28:\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{elif}\;a \leq 5 \cdot 10^{-31}:\\
\;\;\;\;\left(\log y + \log \left(z \cdot {t}^{-0.5}\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if a < -0.28000000000000003Initial program 99.6%
Taylor expanded in x around 0 64.2%
Taylor expanded in a around inf 98.4%
*-commutative98.4%
Simplified98.4%
if -0.28000000000000003 < a < 5e-31Initial program 99.5%
Taylor expanded in x around 0 60.1%
add-sqr-sqrt17.1%
pow217.1%
sub-neg17.1%
metadata-eval17.1%
Applied egg-rr17.1%
unpow217.1%
add-sqr-sqrt60.1%
*-commutative60.1%
add-cube-cbrt60.0%
associate-*r*60.0%
pow260.0%
Applied egg-rr60.0%
Taylor expanded in a around 0 60.1%
log-pow60.1%
log-prod53.2%
Simplified53.2%
if 5e-31 < a Initial program 99.6%
Taylor expanded in x around 0 81.0%
Taylor expanded in a around inf 96.6%
*-commutative96.6%
Simplified96.6%
fma-neg96.7%
Applied egg-rr96.7%
Final simplification76.2%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.4e-6) (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) (fma (log t) a (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.4e-6) {
tmp = log(y) + (log(z) + (log(t) * (a - 0.5)));
} else {
tmp = fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.4e-6) tmp = Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))); else tmp = fma(log(t), a, Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.4e-6], 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[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.4 \cdot 10^{-6}:\\
\;\;\;\;\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if t < 1.39999999999999994e-6Initial program 99.1%
Taylor expanded in x around 0 55.1%
Taylor expanded in t around 0 54.9%
if 1.39999999999999994e-6 < t Initial program 99.9%
Taylor expanded in x around 0 75.2%
Taylor expanded in a around inf 98.0%
*-commutative98.0%
Simplified98.0%
fma-neg98.0%
Applied egg-rr98.0%
Final simplification80.2%
(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(log(z) + log(y)) + Float64(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[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z + \log y\right) + \left(\log t \cdot \left(a - 0.5\right) - t\right)
\end{array}
Initial program 99.5%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-udef99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 66.9%
Final simplification66.9%
(FPCore (x y z t a) :precision binary64 (- (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) t))
double code(double x, double y, double z, double t, double a) {
return (log(y) + (log(z) + (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(y) + (log(z) + (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(y) + (Math.log(z) + (Math.log(t) * (a - 0.5)))) - t;
}
def code(x, y, z, t, a): return (math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5)))) - t
function code(x, y, z, t, a) return Float64(Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(y) + (log(z) + (log(t) * (a - 0.5)))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t
\end{array}
Initial program 99.5%
Taylor expanded in x around 0 66.9%
Final simplification66.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (log (* z (* y (pow t -0.5)))) t)))
(if (<= a -0.048)
(- (* a (log t)) t)
(if (<= a 3.8e-156)
t_1
(if (<= a 2e-132)
(+ (log (+ x y)) (- (log z) t))
(if (<= a 0.026) t_1 (fma (log t) a (- t))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((z * (y * pow(t, -0.5)))) - t;
double tmp;
if (a <= -0.048) {
tmp = (a * log(t)) - t;
} else if (a <= 3.8e-156) {
tmp = t_1;
} else if (a <= 2e-132) {
tmp = log((x + y)) + (log(z) - t);
} else if (a <= 0.026) {
tmp = t_1;
} else {
tmp = fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(z * Float64(y * (t ^ -0.5)))) - t) tmp = 0.0 if (a <= -0.048) tmp = Float64(Float64(a * log(t)) - t); elseif (a <= 3.8e-156) tmp = t_1; elseif (a <= 2e-132) tmp = Float64(log(Float64(x + y)) + Float64(log(z) - t)); elseif (a <= 0.026) tmp = t_1; else tmp = fma(log(t), a, Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(z * N[(y * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[a, -0.048], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[a, 3.8e-156], t$95$1, If[LessEqual[a, 2e-132], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 0.026], t$95$1, N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(z \cdot \left(y \cdot {t}^{-0.5}\right)\right) - t\\
\mathbf{if}\;a \leq -0.048:\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{elif}\;a \leq 3.8 \cdot 10^{-156}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 2 \cdot 10^{-132}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z - t\right)\\
\mathbf{elif}\;a \leq 0.026:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if a < -0.048000000000000001Initial program 99.6%
Taylor expanded in x around 0 64.2%
Taylor expanded in a around inf 98.4%
*-commutative98.4%
Simplified98.4%
if -0.048000000000000001 < a < 3.80000000000000008e-156 or 2e-132 < a < 0.0259999999999999988Initial program 99.5%
Taylor expanded in x around 0 58.9%
add-sqr-sqrt17.3%
pow217.3%
sub-neg17.3%
metadata-eval17.3%
Applied egg-rr17.3%
unpow217.3%
add-sqr-sqrt58.9%
*-commutative58.9%
add-cube-cbrt58.8%
associate-*r*58.8%
pow258.8%
Applied egg-rr58.8%
Taylor expanded in a around 0 58.3%
log-pow58.3%
associate-+r+58.3%
log-prod46.8%
log-pow46.8%
metadata-eval46.8%
associate-*r*46.8%
neg-mul-146.8%
log-rec46.8%
log-pow46.8%
unpow1/246.8%
log-prod42.9%
*-commutative42.9%
unpow1/242.9%
exp-to-pow42.9%
log-rec42.9%
distribute-lft-neg-out42.9%
distribute-rgt-neg-in42.9%
metadata-eval42.9%
exp-to-pow42.9%
*-commutative42.9%
*-commutative42.9%
Simplified43.4%
if 3.80000000000000008e-156 < a < 2e-132Initial program 99.6%
associate-+l-99.6%
associate--l+99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-udef99.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
metadata-eval99.8%
metadata-eval99.8%
unsub-neg99.8%
Simplified99.8%
Taylor expanded in t around inf 80.7%
if 0.0259999999999999988 < a Initial program 99.6%
Taylor expanded in x around 0 81.0%
Taylor expanded in a around inf 97.9%
*-commutative97.9%
Simplified97.9%
fma-neg97.9%
Applied egg-rr97.9%
Final simplification72.0%
(FPCore (x y z t a) :precision binary64 (if (<= t 6000000000.0) (- (+ (log (* (+ x y) z)) (* (log t) (- a 0.5))) t) (fma (log t) a (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 6000000000.0) {
tmp = (log(((x + y) * z)) + (log(t) * (a - 0.5))) - t;
} else {
tmp = fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 6000000000.0) tmp = Float64(Float64(log(Float64(Float64(x + y) * z)) + Float64(log(t) * Float64(a - 0.5))) - t); else tmp = fma(log(t), a, Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 6000000000.0], N[(N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 6000000000:\\
\;\;\;\;\left(\log \left(\left(x + y\right) \cdot z\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if t < 6e9Initial program 99.1%
associate-+l-99.1%
associate--l+99.1%
sub-neg99.1%
+-commutative99.1%
*-commutative99.1%
distribute-rgt-neg-in99.1%
fma-udef99.1%
sub-neg99.1%
+-commutative99.1%
distribute-neg-in99.1%
metadata-eval99.1%
metadata-eval99.1%
unsub-neg99.1%
Simplified99.1%
associate-+r-99.1%
fma-udef99.1%
associate--r+99.1%
sum-log78.7%
Applied egg-rr78.7%
if 6e9 < t Initial program 99.9%
Taylor expanded in x around 0 76.0%
Taylor expanded in a around inf 99.5%
*-commutative99.5%
Simplified99.5%
fma-neg99.5%
Applied egg-rr99.5%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.4e-6) (+ (log (* (+ x y) z)) (* (log t) (- a 0.5))) (fma (log t) a (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.4e-6) {
tmp = log(((x + y) * z)) + (log(t) * (a - 0.5));
} else {
tmp = fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.4e-6) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(log(t) * Float64(a - 0.5))); else tmp = fma(log(t), a, Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.4e-6], N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.4 \cdot 10^{-6}:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if t < 1.39999999999999994e-6Initial program 99.1%
associate-+l-99.1%
associate--l+99.1%
sub-neg99.1%
+-commutative99.1%
*-commutative99.1%
distribute-rgt-neg-in99.1%
fma-udef99.1%
sub-neg99.1%
+-commutative99.1%
distribute-neg-in99.1%
metadata-eval99.1%
metadata-eval99.1%
unsub-neg99.1%
Simplified99.1%
Taylor expanded in t around 0 98.1%
log-prod76.5%
+-commutative76.5%
Simplified76.5%
if 1.39999999999999994e-6 < t Initial program 99.9%
Taylor expanded in x around 0 75.2%
Taylor expanded in a around inf 98.0%
*-commutative98.0%
Simplified98.0%
fma-neg98.0%
Applied egg-rr98.0%
Final simplification89.1%
(FPCore (x y z t a) :precision binary64 (if (<= t 9e-7) (+ (log (* y z)) (* (log t) (- a 0.5))) (fma (log t) a (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 9e-7) {
tmp = log((y * z)) + (log(t) * (a - 0.5));
} else {
tmp = fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 9e-7) tmp = Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5))); else tmp = fma(log(t), a, Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 9e-7], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9 \cdot 10^{-7}:\\
\;\;\;\;\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if t < 8.99999999999999959e-7Initial program 99.1%
associate-+l-99.1%
associate--l+99.1%
sub-neg99.1%
+-commutative99.1%
*-commutative99.1%
distribute-rgt-neg-in99.1%
fma-udef99.1%
sub-neg99.1%
+-commutative99.1%
distribute-neg-in99.1%
metadata-eval99.1%
metadata-eval99.1%
unsub-neg99.1%
Simplified99.1%
Taylor expanded in x around 0 55.2%
Taylor expanded in t around 0 55.0%
log-prod39.9%
*-commutative39.9%
Simplified39.9%
if 8.99999999999999959e-7 < t Initial program 99.9%
Taylor expanded in x around 0 75.2%
Taylor expanded in a around inf 98.0%
*-commutative98.0%
Simplified98.0%
fma-neg98.0%
Applied egg-rr98.0%
Final simplification73.9%
(FPCore (x y z t a) :precision binary64 (fma (log t) a (- t)))
double code(double x, double y, double z, double t, double a) {
return fma(log(t), a, -t);
}
function code(x, y, z, t, a) return fma(log(t), a, Float64(-t)) end
code[x_, y_, z_, t_, a_] := N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log t, a, -t\right)
\end{array}
Initial program 99.5%
Taylor expanded in x around 0 66.9%
Taylor expanded in a around inf 78.4%
*-commutative78.4%
Simplified78.4%
fma-neg78.5%
Applied egg-rr78.5%
Final simplification78.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3e+39) (not (<= a 2.2e+54))) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3e+39) || !(a <= 2.2e+54)) {
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 ((a <= (-3d+39)) .or. (.not. (a <= 2.2d+54))) 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 ((a <= -3e+39) || !(a <= 2.2e+54)) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -3e+39) or not (a <= 2.2e+54): tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3e+39) || !(a <= 2.2e+54)) 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 ((a <= -3e+39) || ~((a <= 2.2e+54))) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3e+39], N[Not[LessEqual[a, 2.2e+54]], $MachinePrecision]], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3 \cdot 10^{+39} \lor \neg \left(a \leq 2.2 \cdot 10^{+54}\right):\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if a < -3e39 or 2.1999999999999999e54 < a 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-udef99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in a around inf 78.8%
*-commutative78.8%
Simplified78.8%
if -3e39 < a < 2.1999999999999999e54Initial program 99.5%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-udef99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in t around inf 58.4%
neg-mul-158.4%
Simplified58.4%
Final simplification67.2%
(FPCore (x y z t a) :precision binary64 (- (* a (log t)) t))
double code(double x, double y, double z, double t, double a) {
return (a * 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 = (a * log(t)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (a * Math.log(t)) - t;
}
def code(x, y, z, t, a): return (a * math.log(t)) - t
function code(x, y, z, t, a) return Float64(Float64(a * log(t)) - t) end
function tmp = code(x, y, z, t, a) tmp = (a * log(t)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \log t - t
\end{array}
Initial program 99.5%
Taylor expanded in x around 0 66.9%
Taylor expanded in a around inf 78.4%
*-commutative78.4%
Simplified78.4%
Final simplification78.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.5%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-udef99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in t around inf 41.8%
neg-mul-141.8%
Simplified41.8%
Final simplification41.8%
(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 2024013
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))