
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
(FPCore (x y z t a) :precision binary64 (+ (log (+ x y)) (- (log z) (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.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%
Final simplification99.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ x y)) (log z))))
(if (<= t_1 -800.0)
(- (+ (log y) (* (log t) a)) t)
(if (<= t_1 705.0)
(- (+ (log (* y z)) (* (- 0.5 a) (log (/ 1.0 t)))) t)
(+ (log y) (fma (log t) a (- t)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y)) + log(z);
double tmp;
if (t_1 <= -800.0) {
tmp = (log(y) + (log(t) * a)) - t;
} else if (t_1 <= 705.0) {
tmp = (log((y * z)) + ((0.5 - a) * log((1.0 / t)))) - t;
} else {
tmp = log(y) + fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(x + y)) + log(z)) tmp = 0.0 if (t_1 <= -800.0) tmp = Float64(Float64(log(y) + Float64(log(t) * a)) - t); elseif (t_1 <= 705.0) tmp = Float64(Float64(log(Float64(y * z)) + Float64(Float64(0.5 - a) * log(Float64(1.0 / t)))) - t); else tmp = Float64(log(y) + fma(log(t), a, Float64(-t))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -800.0], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$1, 705.0], N[(N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 - a), $MachinePrecision] * N[Log[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
\mathbf{if}\;t\_1 \leq -800:\\
\;\;\;\;\left(\log y + \log t \cdot a\right) - t\\
\mathbf{elif}\;t\_1 \leq 705:\\
\;\;\;\;\left(\log \left(y \cdot z\right) + \left(0.5 - a\right) \cdot \log \left(\frac{1}{t}\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y + \mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -800Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 66.7%
Taylor expanded in a around inf 66.7%
*-commutative66.7%
Simplified66.7%
if -800 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 705Initial program 99.5%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
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%
fma-undefine99.5%
associate--r+99.5%
+-commutative99.5%
sum-log99.6%
Applied egg-rr99.6%
Taylor expanded in t around inf 99.6%
Taylor expanded in x around 0 59.6%
if 705 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.5%
associate--l+99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 81.8%
Taylor expanded in a around inf 65.9%
*-commutative65.9%
Simplified65.9%
associate--l+65.9%
fma-neg65.9%
Applied egg-rr65.9%
Final simplification61.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ x y)) (log z))))
(if (or (<= t_1 -800.0) (not (<= t_1 705.0)))
(- (+ (log y) (* (log t) a)) t)
(- (+ (log (* y z)) (* (- 0.5 a) (log (/ 1.0 t)))) t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y)) + log(z);
double tmp;
if ((t_1 <= -800.0) || !(t_1 <= 705.0)) {
tmp = (log(y) + (log(t) * a)) - t;
} else {
tmp = (log((y * z)) + ((0.5 - a) * log((1.0 / 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((x + y)) + log(z)
if ((t_1 <= (-800.0d0)) .or. (.not. (t_1 <= 705.0d0))) then
tmp = (log(y) + (log(t) * a)) - t
else
tmp = (log((y * z)) + ((0.5d0 - a) * log((1.0d0 / 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((x + y)) + Math.log(z);
double tmp;
if ((t_1 <= -800.0) || !(t_1 <= 705.0)) {
tmp = (Math.log(y) + (Math.log(t) * a)) - t;
} else {
tmp = (Math.log((y * z)) + ((0.5 - a) * Math.log((1.0 / t)))) - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((x + y)) + math.log(z) tmp = 0 if (t_1 <= -800.0) or not (t_1 <= 705.0): tmp = (math.log(y) + (math.log(t) * a)) - t else: tmp = (math.log((y * z)) + ((0.5 - a) * math.log((1.0 / t)))) - t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(Float64(x + y)) + log(z)) tmp = 0.0 if ((t_1 <= -800.0) || !(t_1 <= 705.0)) tmp = Float64(Float64(log(y) + Float64(log(t) * a)) - t); else tmp = Float64(Float64(log(Float64(y * z)) + Float64(Float64(0.5 - a) * log(Float64(1.0 / t)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((x + y)) + log(z); tmp = 0.0; if ((t_1 <= -800.0) || ~((t_1 <= 705.0))) tmp = (log(y) + (log(t) * a)) - t; else tmp = (log((y * z)) + ((0.5 - a) * log((1.0 / t)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -800.0], N[Not[LessEqual[t$95$1, 705.0]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 - a), $MachinePrecision] * N[Log[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
\mathbf{if}\;t\_1 \leq -800 \lor \neg \left(t\_1 \leq 705\right):\\
\;\;\;\;\left(\log y + \log t \cdot a\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(y \cdot z\right) + \left(0.5 - a\right) \cdot \log \left(\frac{1}{t}\right)\right) - t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -800 or 705 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
associate--l+99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 80.3%
Taylor expanded in a around inf 66.0%
*-commutative66.0%
Simplified66.0%
if -800 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 705Initial program 99.5%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
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%
fma-undefine99.5%
associate--r+99.5%
+-commutative99.5%
sum-log99.6%
Applied egg-rr99.6%
Taylor expanded in t around inf 99.6%
Taylor expanded in x around 0 59.6%
Final simplification61.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ x y)) (log z))))
(if (or (<= t_1 -800.0) (not (<= t_1 705.0)))
(- (+ (log y) (* (log t) a)) t)
(- (+ (log (* y z)) (* (log t) (- a 0.5))) t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y)) + log(z);
double tmp;
if ((t_1 <= -800.0) || !(t_1 <= 705.0)) {
tmp = (log(y) + (log(t) * a)) - t;
} else {
tmp = (log((y * z)) + (log(t) * (a - 0.5))) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = log((x + y)) + log(z)
if ((t_1 <= (-800.0d0)) .or. (.not. (t_1 <= 705.0d0))) then
tmp = (log(y) + (log(t) * a)) - t
else
tmp = (log((y * z)) + (log(t) * (a - 0.5d0))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = Math.log((x + y)) + Math.log(z);
double tmp;
if ((t_1 <= -800.0) || !(t_1 <= 705.0)) {
tmp = (Math.log(y) + (Math.log(t) * a)) - t;
} else {
tmp = (Math.log((y * z)) + (Math.log(t) * (a - 0.5))) - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((x + y)) + math.log(z) tmp = 0 if (t_1 <= -800.0) or not (t_1 <= 705.0): tmp = (math.log(y) + (math.log(t) * a)) - t else: tmp = (math.log((y * z)) + (math.log(t) * (a - 0.5))) - t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(Float64(x + y)) + log(z)) tmp = 0.0 if ((t_1 <= -800.0) || !(t_1 <= 705.0)) tmp = Float64(Float64(log(y) + Float64(log(t) * a)) - t); else tmp = Float64(Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((x + y)) + log(z); tmp = 0.0; if ((t_1 <= -800.0) || ~((t_1 <= 705.0))) tmp = (log(y) + (log(t) * a)) - t; else tmp = (log((y * z)) + (log(t) * (a - 0.5))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -800.0], N[Not[LessEqual[t$95$1, 705.0]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
\mathbf{if}\;t\_1 \leq -800 \lor \neg \left(t\_1 \leq 705\right):\\
\;\;\;\;\left(\log y + \log t \cdot a\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -800 or 705 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
associate--l+99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 80.3%
Taylor expanded in a around inf 66.0%
*-commutative66.0%
Simplified66.0%
if -800 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 705Initial program 99.5%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
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%
fma-undefine99.5%
associate--r+99.5%
+-commutative99.5%
sum-log99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 59.6%
Final simplification61.1%
(FPCore (x y z t a) :precision binary64 (fma (+ a -0.5) (log t) (- (+ (log z) (log y)) t)))
double code(double x, double y, double z, double t, double a) {
return fma((a + -0.5), log(t), ((log(z) + log(y)) - t));
}
function code(x, y, z, t, a) return fma(Float64(a + -0.5), log(t), Float64(Float64(log(z) + log(y)) - t)) end
code[x_, y_, z_, t_, a_] := N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a + -0.5, \log t, \left(\log z + \log y\right) - t\right)
\end{array}
Initial program 99.5%
+-commutative99.5%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
associate--l+99.6%
Simplified99.6%
Taylor expanded in x around 0 68.3%
+-commutative68.3%
Simplified68.3%
Final simplification68.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= (- a 0.5) -100.0) (not (<= (- a 0.5) -0.4))) (+ (log y) (fma (log t) a (- t))) (+ (- (+ (log z) (log y)) t) (* (log t) -0.5))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a - 0.5) <= -100.0) || !((a - 0.5) <= -0.4)) {
tmp = log(y) + fma(log(t), a, -t);
} else {
tmp = ((log(z) + log(y)) - t) + (log(t) * -0.5);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(a - 0.5) <= -100.0) || !(Float64(a - 0.5) <= -0.4)) tmp = Float64(log(y) + fma(log(t), a, Float64(-t))); else tmp = Float64(Float64(Float64(log(z) + log(y)) - t) + Float64(log(t) * -0.5)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -100.0], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], -0.4]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -100 \lor \neg \left(a - 0.5 \leq -0.4\right):\\
\;\;\;\;\log y + \mathsf{fma}\left(\log t, a, -t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\log z + \log y\right) - t\right) + \log t \cdot -0.5\\
\end{array}
\end{array}
if (-.f64 a 1/2) < -100 or -0.40000000000000002 < (-.f64 a 1/2) Initial program 99.6%
associate--l+99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 67.9%
Taylor expanded in a around inf 67.0%
*-commutative67.0%
Simplified67.0%
associate--l+67.0%
fma-neg67.0%
Applied egg-rr67.0%
if -100 < (-.f64 a 1/2) < -0.40000000000000002Initial program 99.5%
associate--l+99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
metadata-eval99.5%
sub-neg99.5%
flip--99.5%
metadata-eval99.5%
metadata-eval99.5%
associate-*l/99.5%
fma-neg99.5%
metadata-eval99.5%
metadata-eval99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in a around 0 68.5%
Final simplification67.7%
(FPCore (x y z t a) :precision binary64 (+ (+ (log z) (- (log y) t)) (* (log t) (+ a -0.5))))
double code(double x, double y, double z, double t, double a) {
return (log(z) + (log(y) - 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(z) + (log(y) - 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(z) + (Math.log(y) - t)) + (Math.log(t) * (a + -0.5));
}
def code(x, y, z, t, a): return (math.log(z) + (math.log(y) - t)) + (math.log(t) * (a + -0.5))
function code(x, y, z, t, a) return Float64(Float64(log(z) + Float64(log(y) - t)) + Float64(log(t) * Float64(a + -0.5))) end
function tmp = code(x, y, z, t, a) tmp = (log(z) + (log(y) - t)) + (log(t) * (a + -0.5)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z + \left(\log y - t\right)\right) + \log t \cdot \left(a + -0.5\right)
\end{array}
Initial program 99.5%
associate--l+99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 68.3%
remove-double-neg68.3%
log-rec68.3%
mul-1-neg68.3%
+-commutative68.3%
associate--l+68.3%
mul-1-neg68.3%
log-rec68.3%
remove-double-neg68.3%
Simplified68.3%
Final simplification68.3%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.05e-5) (+ (* (log t) (+ a -0.5)) (log (* y z))) (- (+ (log y) (* (log t) a)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.05e-5) {
tmp = (log(t) * (a + -0.5)) + log((y * z));
} else {
tmp = (log(y) + (log(t) * a)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 1.05d-5) then
tmp = (log(t) * (a + (-0.5d0))) + log((y * z))
else
tmp = (log(y) + (log(t) * a)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.05e-5) {
tmp = (Math.log(t) * (a + -0.5)) + Math.log((y * z));
} else {
tmp = (Math.log(y) + (Math.log(t) * a)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.05e-5: tmp = (math.log(t) * (a + -0.5)) + math.log((y * z)) else: tmp = (math.log(y) + (math.log(t) * a)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.05e-5) tmp = Float64(Float64(log(t) * Float64(a + -0.5)) + log(Float64(y * z))); else tmp = Float64(Float64(log(y) + Float64(log(t) * a)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.05e-5) tmp = (log(t) * (a + -0.5)) + log((y * z)); else tmp = (log(y) + (log(t) * a)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.05e-5], N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.05 \cdot 10^{-5}:\\
\;\;\;\;\log t \cdot \left(a + -0.5\right) + \log \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log y + \log t \cdot a\right) - t\\
\end{array}
\end{array}
if t < 1.04999999999999994e-5Initial program 99.3%
+-commutative99.3%
fma-define99.3%
sub-neg99.3%
metadata-eval99.3%
associate--l+99.3%
Simplified99.3%
Taylor expanded in x around 0 59.4%
+-commutative59.4%
Simplified59.4%
Taylor expanded in t around 0 58.8%
associate-+r+58.8%
log-prod39.7%
sub-neg39.7%
metadata-eval39.7%
+-commutative39.7%
Simplified39.7%
if 1.04999999999999994e-5 < t Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 76.5%
Taylor expanded in a around inf 73.6%
*-commutative73.6%
Simplified73.6%
Final simplification57.3%
(FPCore (x y z t a) :precision binary64 (if (<= t 2.8e+48) (+ (log y) (* (log t) a)) (+ (log (+ x y)) (- (log z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.8e+48) {
tmp = log(y) + (log(t) * a);
} else {
tmp = log((x + y)) + (log(z) - 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 <= 2.8d+48) then
tmp = log(y) + (log(t) * a)
else
tmp = log((x + y)) + (log(z) - 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 <= 2.8e+48) {
tmp = Math.log(y) + (Math.log(t) * a);
} else {
tmp = Math.log((x + y)) + (Math.log(z) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2.8e+48: tmp = math.log(y) + (math.log(t) * a) else: tmp = math.log((x + y)) + (math.log(z) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2.8e+48) tmp = Float64(log(y) + Float64(log(t) * a)); else tmp = Float64(log(Float64(x + y)) + Float64(log(z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 2.8e+48) tmp = log(y) + (log(t) * a); else tmp = log((x + y)) + (log(z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.8e+48], N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.8 \cdot 10^{+48}:\\
\;\;\;\;\log y + \log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z - t\right)\\
\end{array}
\end{array}
if t < 2.80000000000000012e48Initial program 99.4%
associate--l+99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 61.3%
Taylor expanded in a around inf 39.6%
*-commutative39.6%
Simplified39.6%
Taylor expanded in t around 0 37.7%
if 2.80000000000000012e48 < t Initial program 99.8%
associate-+l-99.8%
associate--l+99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-undefine99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 81.6%
Final simplification56.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 2.45e+51) (+ (log y) (* (log t) a)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.45e+51) {
tmp = log(y) + (log(t) * a);
} 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 <= 2.45d+51) then
tmp = log(y) + (log(t) * a)
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 <= 2.45e+51) {
tmp = Math.log(y) + (Math.log(t) * a);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2.45e+51: tmp = math.log(y) + (math.log(t) * a) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2.45e+51) tmp = Float64(log(y) + Float64(log(t) * a)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 2.45e+51) tmp = log(y) + (log(t) * a); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.45e+51], N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.45 \cdot 10^{+51}:\\
\;\;\;\;\log y + \log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 2.44999999999999992e51Initial program 99.4%
associate--l+99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 61.3%
Taylor expanded in a around inf 39.6%
*-commutative39.6%
Simplified39.6%
Taylor expanded in t around 0 37.7%
if 2.44999999999999992e51 < t Initial program 99.8%
+-commutative99.8%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 77.9%
+-commutative77.9%
Simplified77.9%
Taylor expanded in t around inf 81.6%
neg-mul-181.6%
Simplified81.6%
Final simplification56.4%
(FPCore (x y z t a) :precision binary64 (- (+ (log y) (* (log t) a)) t))
double code(double x, double y, double z, double t, double a) {
return (log(y) + (log(t) * a)) - 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(t) * a)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(y) + (Math.log(t) * a)) - t;
}
def code(x, y, z, t, a): return (math.log(y) + (math.log(t) * a)) - t
function code(x, y, z, t, a) return Float64(Float64(log(y) + Float64(log(t) * a)) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(y) + (log(t) * a)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y + \log t \cdot a\right) - t
\end{array}
Initial program 99.5%
associate--l+99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 68.3%
Taylor expanded in a around inf 55.9%
*-commutative55.9%
Simplified55.9%
Final simplification55.9%
(FPCore (x y z t a) :precision binary64 (if (<= t 370.0) (log (+ x y)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 370.0) {
tmp = log((x + y));
} 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 <= 370.0d0) then
tmp = log((x + y))
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 <= 370.0) {
tmp = Math.log((x + y));
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 370.0: tmp = math.log((x + y)) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 370.0) tmp = log(Float64(x + y)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 370.0) tmp = log((x + y)); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 370.0], N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 370:\\
\;\;\;\;\log \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 370Initial 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%
Taylor expanded in t around inf 8.9%
neg-mul-18.9%
Simplified8.9%
Taylor expanded in t around 0 8.9%
+-commutative8.9%
Simplified8.9%
if 370 < t Initial program 99.8%
+-commutative99.8%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 75.5%
+-commutative75.5%
Simplified75.5%
Taylor expanded in t around inf 75.6%
neg-mul-175.6%
Simplified75.6%
Final simplification42.0%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.9e+48) (* (log t) a) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.9e+48) {
tmp = log(t) * a;
} else {
tmp = -t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 1.9d+48) then
tmp = log(t) * a
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.9e+48) {
tmp = Math.log(t) * a;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.9e+48: tmp = math.log(t) * a else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.9e+48) tmp = Float64(log(t) * a); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.9e+48) tmp = log(t) * a; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.9e+48], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.9 \cdot 10^{+48}:\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 1.9e48Initial program 99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
associate--l+99.4%
Simplified99.4%
Taylor expanded in x around 0 61.3%
+-commutative61.3%
Simplified61.3%
Taylor expanded in a around inf 50.3%
*-commutative50.3%
Simplified50.3%
if 1.9e48 < t Initial program 99.8%
+-commutative99.8%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 77.9%
+-commutative77.9%
Simplified77.9%
Taylor expanded in t around inf 81.6%
neg-mul-181.6%
Simplified81.6%
Final simplification63.6%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return 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%
+-commutative99.5%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
associate--l+99.6%
Simplified99.6%
Taylor expanded in x around 0 68.3%
+-commutative68.3%
Simplified68.3%
Taylor expanded in t around inf 38.9%
neg-mul-138.9%
Simplified38.9%
Final simplification38.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 2024043
(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))))