
(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 z) (+ (log (+ x y)) (+ (* -0.5 (log t)) (* (log t) a)))) t))
double code(double x, double y, double z, double t, double a) {
return (log(z) + (log((x + y)) + ((-0.5 * log(t)) + (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(z) + (log((x + y)) + (((-0.5d0) * log(t)) + (log(t) * a)))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(z) + (Math.log((x + y)) + ((-0.5 * Math.log(t)) + (Math.log(t) * a)))) - t;
}
def code(x, y, z, t, a): return (math.log(z) + (math.log((x + y)) + ((-0.5 * math.log(t)) + (math.log(t) * a)))) - t
function code(x, y, z, t, a) return Float64(Float64(log(z) + Float64(log(Float64(x + y)) + Float64(Float64(-0.5 * log(t)) + Float64(log(t) * a)))) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(z) + (log((x + y)) + ((-0.5 * log(t)) + (log(t) * a)))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z + \left(\log \left(x + y\right) + \left(-0.5 \cdot \log t + \log t \cdot a\right)\right)\right) - t
\end{array}
Initial program 99.5%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.5%
+-commutative99.5%
fma-define99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in a around 0 99.5%
Final simplification99.5%
(FPCore (x y z t a)
:precision binary64
(if (<= t 0.0155)
(+ (log z) (- (log y) (* (log t) (- 0.5 a))))
(if (<= t 2.8e+148)
(+ (log (* z (+ x y))) (- (* (log t) (+ -0.5 a)) t))
(+ (- 1.0 t) -1.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.0155) {
tmp = log(z) + (log(y) - (log(t) * (0.5 - a)));
} else if (t <= 2.8e+148) {
tmp = log((z * (x + y))) + ((log(t) * (-0.5 + a)) - t);
} else {
tmp = (1.0 - t) + -1.0;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 0.0155d0) then
tmp = log(z) + (log(y) - (log(t) * (0.5d0 - a)))
else if (t <= 2.8d+148) then
tmp = log((z * (x + y))) + ((log(t) * ((-0.5d0) + a)) - t)
else
tmp = (1.0d0 - t) + (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.0155) {
tmp = Math.log(z) + (Math.log(y) - (Math.log(t) * (0.5 - a)));
} else if (t <= 2.8e+148) {
tmp = Math.log((z * (x + y))) + ((Math.log(t) * (-0.5 + a)) - t);
} else {
tmp = (1.0 - t) + -1.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.0155: tmp = math.log(z) + (math.log(y) - (math.log(t) * (0.5 - a))) elif t <= 2.8e+148: tmp = math.log((z * (x + y))) + ((math.log(t) * (-0.5 + a)) - t) else: tmp = (1.0 - t) + -1.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.0155) tmp = Float64(log(z) + Float64(log(y) - Float64(log(t) * Float64(0.5 - a)))); elseif (t <= 2.8e+148) tmp = Float64(log(Float64(z * Float64(x + y))) + Float64(Float64(log(t) * Float64(-0.5 + a)) - t)); else tmp = Float64(Float64(1.0 - t) + -1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 0.0155) tmp = log(z) + (log(y) - (log(t) * (0.5 - a))); elseif (t <= 2.8e+148) tmp = log((z * (x + y))) + ((log(t) * (-0.5 + a)) - t); else tmp = (1.0 - t) + -1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.0155], N[(N[Log[z], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * N[(0.5 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.8e+148], N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(-0.5 + a), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.0155:\\
\;\;\;\;\log z + \left(\log y - \log t \cdot \left(0.5 - a\right)\right)\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+148}:\\
\;\;\;\;\log \left(z \cdot \left(x + y\right)\right) + \left(\log t \cdot \left(-0.5 + a\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) + -1\\
\end{array}
\end{array}
if t < 0.0155Initial program 99.2%
associate--l+99.2%
+-commutative99.2%
associate-+l+99.2%
+-commutative99.2%
fma-define99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around 0 64.8%
Taylor expanded in t around 0 64.8%
if 0.0155 < t < 2.7999999999999998e148Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
+-commutative99.6%
fma-undefine99.7%
metadata-eval99.7%
sub-neg99.7%
associate-+r+99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l-99.7%
sum-log86.2%
sub-neg86.2%
metadata-eval86.2%
*-commutative86.2%
Applied egg-rr86.2%
if 2.7999999999999998e148 < t Initial program 99.9%
associate-+l-99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-undefine99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 90.5%
neg-mul-190.5%
Simplified90.5%
expm1-log1p-u0.0%
expm1-undefine0.0%
Applied egg-rr0.0%
sub-neg0.0%
log1p-undefine0.0%
rem-exp-log90.5%
unsub-neg90.5%
metadata-eval90.5%
Simplified90.5%
Final simplification76.1%
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log z) (log (+ x y))) t) (* (log t) (- a 0.5))))
double code(double x, double y, double z, double t, double a) {
return ((log(z) + log((x + 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((x + 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((x + y))) - t) + (Math.log(t) * (a - 0.5));
}
def code(x, y, z, t, a): return ((math.log(z) + math.log((x + y))) - t) + (math.log(t) * (a - 0.5))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(z) + log(Float64(x + y))) - t) + Float64(log(t) * Float64(a - 0.5))) end
function tmp = code(x, y, z, t, a) tmp = ((log(z) + log((x + y))) - t) + (log(t) * (a - 0.5)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[z], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log z + \log \left(x + y\right)\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 (- (+ (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%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.5%
+-commutative99.5%
fma-define99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 70.0%
(FPCore (x y z t a) :precision binary64 (+ (- (log z) t) (- (log y) (* (log t) (- 0.5 a)))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + (log(y) - (log(t) * (0.5 - a)));
}
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) * (0.5d0 - a)))
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) * (0.5 - a)));
}
def code(x, y, z, t, a): return (math.log(z) - t) + (math.log(y) - (math.log(t) * (0.5 - a)))
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + Float64(log(y) - Float64(log(t) * Float64(0.5 - a)))) end
function tmp = code(x, y, z, t, a) tmp = (log(z) - t) + (log(y) - (log(t) * (0.5 - a))); 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[(0.5 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \left(\log y - \log t \cdot \left(0.5 - a\right)\right)
\end{array}
Initial program 99.5%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.5%
+-commutative99.5%
fma-define99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 69.9%
Final simplification69.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (log t) a)))
(if (<= a -6.2)
t_1
(if (<= a 1.5e-40)
(- (log (* (* z y) (pow t (+ -0.5 a)))) t)
(if (<= a 9e+26) (+ (log (+ x y)) (- (log z) t)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * a;
double tmp;
if (a <= -6.2) {
tmp = t_1;
} else if (a <= 1.5e-40) {
tmp = log(((z * y) * pow(t, (-0.5 + a)))) - t;
} else if (a <= 9e+26) {
tmp = log((x + y)) + (log(z) - t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = log(t) * a
if (a <= (-6.2d0)) then
tmp = t_1
else if (a <= 1.5d-40) then
tmp = log(((z * y) * (t ** ((-0.5d0) + a)))) - t
else if (a <= 9d+26) then
tmp = log((x + y)) + (log(z) - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = Math.log(t) * a;
double tmp;
if (a <= -6.2) {
tmp = t_1;
} else if (a <= 1.5e-40) {
tmp = Math.log(((z * y) * Math.pow(t, (-0.5 + a)))) - t;
} else if (a <= 9e+26) {
tmp = Math.log((x + y)) + (Math.log(z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(t) * a tmp = 0 if a <= -6.2: tmp = t_1 elif a <= 1.5e-40: tmp = math.log(((z * y) * math.pow(t, (-0.5 + a)))) - t elif a <= 9e+26: tmp = math.log((x + y)) + (math.log(z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(log(t) * a) tmp = 0.0 if (a <= -6.2) tmp = t_1; elseif (a <= 1.5e-40) tmp = Float64(log(Float64(Float64(z * y) * (t ^ Float64(-0.5 + a)))) - t); elseif (a <= 9e+26) tmp = Float64(log(Float64(x + y)) + Float64(log(z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(t) * a; tmp = 0.0; if (a <= -6.2) tmp = t_1; elseif (a <= 1.5e-40) tmp = log(((z * y) * (t ^ (-0.5 + a)))) - t; elseif (a <= 9e+26) tmp = log((x + y)) + (log(z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -6.2], t$95$1, If[LessEqual[a, 1.5e-40], N[(N[Log[N[(N[(z * y), $MachinePrecision] * N[Power[t, N[(-0.5 + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision], If[LessEqual[a, 9e+26], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot a\\
\mathbf{if}\;a \leq -6.2:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.5 \cdot 10^{-40}:\\
\;\;\;\;\log \left(\left(z \cdot y\right) \cdot {t}^{\left(-0.5 + a\right)}\right) - t\\
\mathbf{elif}\;a \leq 9 \cdot 10^{+26}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -6.20000000000000018 or 8.99999999999999957e26 < 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-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 a around inf 79.1%
*-commutative79.1%
Simplified79.1%
if -6.20000000000000018 < a < 1.5000000000000001e-40Initial program 99.4%
associate--l+99.4%
+-commutative99.4%
associate-+l+99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in a around 0 99.4%
sub-neg99.4%
add-log-exp91.1%
sum-log77.9%
exp-sum78.0%
add-exp-log78.0%
distribute-rgt-out78.0%
exp-to-pow78.3%
Applied egg-rr78.3%
sub-neg78.3%
*-commutative78.3%
+-commutative78.3%
associate-*r*74.3%
Simplified74.3%
Taylor expanded in x around 0 48.8%
*-commutative48.8%
exp-to-pow48.9%
sub-neg48.9%
metadata-eval48.9%
+-commutative48.9%
associate-*l*53.2%
*-commutative53.2%
associate-*r*49.6%
Simplified49.6%
if 1.5000000000000001e-40 < a < 8.99999999999999957e26Initial program 99.6%
associate-+l-99.7%
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.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.7e+150) (+ (log (* z (+ x y))) (- (* (log t) (+ -0.5 a)) t)) (+ (- 1.0 t) -1.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.7e+150) {
tmp = log((z * (x + y))) + ((log(t) * (-0.5 + a)) - t);
} else {
tmp = (1.0 - t) + -1.0;
}
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.7d+150) then
tmp = log((z * (x + y))) + ((log(t) * ((-0.5d0) + a)) - t)
else
tmp = (1.0d0 - t) + (-1.0d0)
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.7e+150) {
tmp = Math.log((z * (x + y))) + ((Math.log(t) * (-0.5 + a)) - t);
} else {
tmp = (1.0 - t) + -1.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.7e+150: tmp = math.log((z * (x + y))) + ((math.log(t) * (-0.5 + a)) - t) else: tmp = (1.0 - t) + -1.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.7e+150) tmp = Float64(log(Float64(z * Float64(x + y))) + Float64(Float64(log(t) * Float64(-0.5 + a)) - t)); else tmp = Float64(Float64(1.0 - t) + -1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.7e+150) tmp = log((z * (x + y))) + ((log(t) * (-0.5 + a)) - t); else tmp = (1.0 - t) + -1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.7e+150], N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(-0.5 + a), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.7 \cdot 10^{+150}:\\
\;\;\;\;\log \left(z \cdot \left(x + y\right)\right) + \left(\log t \cdot \left(-0.5 + a\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) + -1\\
\end{array}
\end{array}
if t < 1.69999999999999991e150Initial program 99.4%
associate--l+99.4%
+-commutative99.4%
associate-+l+99.4%
+-commutative99.4%
fma-define99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
+-commutative99.3%
fma-undefine99.4%
metadata-eval99.4%
sub-neg99.4%
associate-+r+99.4%
associate--l+99.4%
+-commutative99.4%
associate-+l-99.4%
sum-log81.1%
sub-neg81.1%
metadata-eval81.1%
*-commutative81.1%
Applied egg-rr81.1%
if 1.69999999999999991e150 < t Initial program 99.9%
associate-+l-99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-undefine99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 90.5%
neg-mul-190.5%
Simplified90.5%
expm1-log1p-u0.0%
expm1-undefine0.0%
Applied egg-rr0.0%
sub-neg0.0%
log1p-undefine0.0%
rem-exp-log90.5%
unsub-neg90.5%
metadata-eval90.5%
Simplified90.5%
Final simplification83.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -21.0) (not (<= a 4e+32))) (* (log t) a) (+ (log (+ x y)) (- (log z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -21.0) || !(a <= 4e+32)) {
tmp = 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 ((a <= (-21.0d0)) .or. (.not. (a <= 4d+32))) then
tmp = 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 ((a <= -21.0) || !(a <= 4e+32)) {
tmp = 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 (a <= -21.0) or not (a <= 4e+32): tmp = 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 ((a <= -21.0) || !(a <= 4e+32)) tmp = 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 ((a <= -21.0) || ~((a <= 4e+32))) tmp = log(t) * a; else tmp = log((x + y)) + (log(z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -21.0], N[Not[LessEqual[a, 4e+32]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] * a), $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}\;a \leq -21 \lor \neg \left(a \leq 4 \cdot 10^{+32}\right):\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z - t\right)\\
\end{array}
\end{array}
if a < -21 or 4.00000000000000021e32 < 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-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 a around inf 79.1%
*-commutative79.1%
Simplified79.1%
if -21 < a < 4.00000000000000021e32Initial program 99.4%
associate-+l-99.4%
associate--l+99.4%
sub-neg99.4%
+-commutative99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
fma-undefine99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
metadata-eval99.4%
metadata-eval99.4%
unsub-neg99.4%
Simplified99.4%
Taylor expanded in t around inf 59.3%
Final simplification68.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.25e+16) (+ (* (log t) (+ -0.5 a)) (log (* z (+ x y)))) (+ (log (+ x y)) (- (log z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.25e+16) {
tmp = (log(t) * (-0.5 + a)) + log((z * (x + y)));
} 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 <= 1.25d+16) then
tmp = (log(t) * ((-0.5d0) + a)) + log((z * (x + y)))
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 <= 1.25e+16) {
tmp = (Math.log(t) * (-0.5 + a)) + Math.log((z * (x + y)));
} else {
tmp = Math.log((x + y)) + (Math.log(z) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.25e+16: tmp = (math.log(t) * (-0.5 + a)) + math.log((z * (x + y))) else: tmp = math.log((x + y)) + (math.log(z) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.25e+16) tmp = Float64(Float64(log(t) * Float64(-0.5 + a)) + log(Float64(z * Float64(x + y)))); 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 <= 1.25e+16) tmp = (log(t) * (-0.5 + a)) + log((z * (x + y))); else tmp = log((x + y)) + (log(z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.25e+16], N[(N[(N[Log[t], $MachinePrecision] * N[(-0.5 + a), $MachinePrecision]), $MachinePrecision] + N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $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 1.25 \cdot 10^{+16}:\\
\;\;\;\;\log t \cdot \left(-0.5 + a\right) + \log \left(z \cdot \left(x + y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z - t\right)\\
\end{array}
\end{array}
if t < 1.25e16Initial program 99.2%
associate--l+99.2%
+-commutative99.2%
associate-+l+99.2%
+-commutative99.2%
fma-define99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in a around 0 99.2%
sub-neg99.2%
add-log-exp40.7%
sum-log35.2%
exp-sum35.3%
add-exp-log35.3%
distribute-rgt-out35.3%
exp-to-pow35.6%
Applied egg-rr35.6%
sub-neg35.6%
*-commutative35.6%
+-commutative35.6%
associate-*r*35.6%
Simplified35.6%
Taylor expanded in t around 0 33.9%
Simplified34.1%
associate-*r*36.0%
log-prod37.9%
log-pow77.3%
+-commutative77.3%
Applied egg-rr77.3%
+-commutative77.3%
*-commutative77.3%
+-commutative77.3%
Simplified77.3%
if 1.25e16 < t Initial program 99.9%
associate-+l-99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-undefine99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 78.5%
Final simplification77.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 2.4e+16) (* (log t) a) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.4e+16) {
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 <= 2.4d+16) 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 <= 2.4e+16) {
tmp = Math.log(t) * a;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2.4e+16: tmp = math.log(t) * a else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2.4e+16) 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 <= 2.4e+16) tmp = log(t) * a; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.4e+16], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.4 \cdot 10^{+16}:\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 2.4e16Initial program 99.2%
associate-+l-99.2%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-undefine99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in a around inf 53.2%
*-commutative53.2%
Simplified53.2%
if 2.4e16 < t Initial program 99.9%
associate-+l-99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-undefine99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 78.4%
neg-mul-178.4%
Simplified78.4%
(FPCore (x y z t a) :precision binary64 (+ -1.0 (* t (+ -1.0 (/ 1.0 t)))))
double code(double x, double y, double z, double t, double a) {
return -1.0 + (t * (-1.0 + (1.0 / 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 = (-1.0d0) + (t * ((-1.0d0) + (1.0d0 / t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return -1.0 + (t * (-1.0 + (1.0 / t)));
}
def code(x, y, z, t, a): return -1.0 + (t * (-1.0 + (1.0 / t)))
function code(x, y, z, t, a) return Float64(-1.0 + Float64(t * Float64(-1.0 + Float64(1.0 / t)))) end
function tmp = code(x, y, z, t, a) tmp = -1.0 + (t * (-1.0 + (1.0 / t))); end
code[x_, y_, z_, t_, a_] := N[(-1.0 + N[(t * N[(-1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1 + t \cdot \left(-1 + \frac{1}{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-undefine99.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 37.6%
neg-mul-137.6%
Simplified37.6%
expm1-log1p-u1.4%
expm1-undefine1.4%
Applied egg-rr1.4%
sub-neg1.4%
log1p-undefine1.4%
rem-exp-log37.6%
unsub-neg37.6%
metadata-eval37.6%
Simplified37.6%
Taylor expanded in t around inf 37.7%
Final simplification37.7%
(FPCore (x y z t a) :precision binary64 (+ (- 1.0 t) -1.0))
double code(double x, double y, double z, double t, double a) {
return (1.0 - t) + -1.0;
}
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 = (1.0d0 - t) + (-1.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return (1.0 - t) + -1.0;
}
def code(x, y, z, t, a): return (1.0 - t) + -1.0
function code(x, y, z, t, a) return Float64(Float64(1.0 - t) + -1.0) end
function tmp = code(x, y, z, t, a) tmp = (1.0 - t) + -1.0; end
code[x_, y_, z_, t_, a_] := N[(N[(1.0 - t), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - t\right) + -1
\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-undefine99.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 37.6%
neg-mul-137.6%
Simplified37.6%
expm1-log1p-u1.4%
expm1-undefine1.4%
Applied egg-rr1.4%
sub-neg1.4%
log1p-undefine1.4%
rem-exp-log37.6%
unsub-neg37.6%
metadata-eval37.6%
Simplified37.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%
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%
Taylor expanded in t around inf 37.6%
neg-mul-137.6%
Simplified37.6%
(FPCore (x y z t a) :precision binary64 0.0)
double code(double x, double y, double z, double t, double a) {
return 0.0;
}
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 = 0.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
return 0.0;
}
def code(x, y, z, t, a): return 0.0
function code(x, y, z, t, a) return 0.0 end
function tmp = code(x, y, z, t, a) tmp = 0.0; end
code[x_, y_, z_, t_, a_] := 0.0
\begin{array}{l}
\\
0
\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-undefine99.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 37.6%
neg-mul-137.6%
Simplified37.6%
expm1-log1p-u1.4%
expm1-undefine1.4%
Applied egg-rr1.4%
sub-neg1.4%
log1p-undefine1.4%
rem-exp-log37.6%
unsub-neg37.6%
metadata-eval37.6%
Simplified37.6%
Taylor expanded in t around 0 2.4%
metadata-eval2.4%
Applied egg-rr2.4%
(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 2024157
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (+ (log (+ x y)) (+ (- (log z) t) (* (- a 1/2) (log t)))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))