
(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 12 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)) (- (* (log t) (- a 0.5)) t))))
double code(double x, double y, double z, double t, double a) {
return log(z) + (log((x + 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((x + 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((x + y)) + ((Math.log(t) * (a - 0.5)) - t));
}
def code(x, y, z, t, a): return math.log(z) + (math.log((x + y)) + ((math.log(t) * (a - 0.5)) - t))
function code(x, y, z, t, a) return Float64(log(z) + Float64(log(Float64(x + y)) + Float64(Float64(log(t) * Float64(a - 0.5)) - t))) end
function tmp = code(x, y, z, t, a) tmp = log(z) + (log((x + y)) + ((log(t) * (a - 0.5)) - t)); end
code[x_, y_, z_, t_, a_] := N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log z + \left(\log \left(x + y\right) + \left(\log t \cdot \left(a - 0.5\right) - t\right)\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
associate-+l+99.6%
+-commutative99.6%
associate-+r-99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in t around 0 99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= (- a 0.5) -50.0) (not (<= (- a 0.5) -0.5))) (+ (log (+ x y)) (- (* (log t) a) t)) (+ (- (log z) t) (+ (log y) (* (log t) -0.5)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a - 0.5) <= -50.0) || !((a - 0.5) <= -0.5)) {
tmp = log((x + y)) + ((log(t) * a) - t);
} else {
tmp = (log(z) - t) + (log(y) + (log(t) * -0.5));
}
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 - 0.5d0) <= (-50.0d0)) .or. (.not. ((a - 0.5d0) <= (-0.5d0)))) then
tmp = log((x + y)) + ((log(t) * a) - t)
else
tmp = (log(z) - t) + (log(y) + (log(t) * (-0.5d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a - 0.5) <= -50.0) || !((a - 0.5) <= -0.5)) {
tmp = Math.log((x + y)) + ((Math.log(t) * a) - t);
} else {
tmp = (Math.log(z) - t) + (Math.log(y) + (Math.log(t) * -0.5));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((a - 0.5) <= -50.0) or not ((a - 0.5) <= -0.5): tmp = math.log((x + y)) + ((math.log(t) * a) - t) else: tmp = (math.log(z) - t) + (math.log(y) + (math.log(t) * -0.5)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(a - 0.5) <= -50.0) || !(Float64(a - 0.5) <= -0.5)) tmp = Float64(log(Float64(x + y)) + Float64(Float64(log(t) * a) - t)); else tmp = Float64(Float64(log(z) - t) + Float64(log(y) + Float64(log(t) * -0.5))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((a - 0.5) <= -50.0) || ~(((a - 0.5) <= -0.5))) tmp = log((x + y)) + ((log(t) * a) - t); else tmp = (log(z) - t) + (log(y) + (log(t) * -0.5)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -50.0], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], -0.5]], $MachinePrecision]], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -50 \lor \neg \left(a - 0.5 \leq -0.5\right):\\
\;\;\;\;\log \left(x + y\right) + \left(\log t \cdot a - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + \left(\log y + \log t \cdot -0.5\right)\\
\end{array}
\end{array}
if (-.f64 a 1/2) < -50 or -0.5 < (-.f64 a 1/2) Initial program 99.7%
associate--l+99.7%
associate-+l+99.7%
+-commutative99.7%
associate-+r-99.7%
fma-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 98.7%
*-commutative98.7%
Simplified98.7%
if -50 < (-.f64 a 1/2) < -0.5Initial program 99.4%
associate--l+99.4%
+-commutative99.4%
associate-+l+99.5%
+-commutative99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in a around 0 99.3%
+-commutative99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in y around inf 66.0%
+-commutative66.0%
mul-1-neg66.0%
log-rec66.0%
remove-double-neg66.0%
Simplified66.0%
Final simplification83.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (log (+ x y))))
(if (or (<= a -0.84) (not (<= a 9e-15)))
(+ t_1 (- (* (log t) a) t))
(+ t_1 (- (+ (log z) (* (log t) -0.5)) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y));
double tmp;
if ((a <= -0.84) || !(a <= 9e-15)) {
tmp = t_1 + ((log(t) * a) - t);
} else {
tmp = t_1 + ((log(z) + (log(t) * -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))
if ((a <= (-0.84d0)) .or. (.not. (a <= 9d-15))) then
tmp = t_1 + ((log(t) * a) - t)
else
tmp = t_1 + ((log(z) + (log(t) * (-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));
double tmp;
if ((a <= -0.84) || !(a <= 9e-15)) {
tmp = t_1 + ((Math.log(t) * a) - t);
} else {
tmp = t_1 + ((Math.log(z) + (Math.log(t) * -0.5)) - t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((x + y)) tmp = 0 if (a <= -0.84) or not (a <= 9e-15): tmp = t_1 + ((math.log(t) * a) - t) else: tmp = t_1 + ((math.log(z) + (math.log(t) * -0.5)) - t) return tmp
function code(x, y, z, t, a) t_1 = log(Float64(x + y)) tmp = 0.0 if ((a <= -0.84) || !(a <= 9e-15)) tmp = Float64(t_1 + Float64(Float64(log(t) * a) - t)); else tmp = Float64(t_1 + Float64(Float64(log(z) + Float64(log(t) * -0.5)) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((x + y)); tmp = 0.0; if ((a <= -0.84) || ~((a <= 9e-15))) tmp = t_1 + ((log(t) * a) - t); else tmp = t_1 + ((log(z) + (log(t) * -0.5)) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[a, -0.84], N[Not[LessEqual[a, 9e-15]], $MachinePrecision]], N[(t$95$1 + N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right)\\
\mathbf{if}\;a \leq -0.84 \lor \neg \left(a \leq 9 \cdot 10^{-15}\right):\\
\;\;\;\;t_1 + \left(\log t \cdot a - t\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\left(\log z + \log t \cdot -0.5\right) - t\right)\\
\end{array}
\end{array}
if a < -0.839999999999999969 or 8.9999999999999995e-15 < a Initial program 99.7%
associate--l+99.7%
associate-+l+99.7%
+-commutative99.7%
associate-+r-99.7%
fma-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 98.7%
*-commutative98.7%
Simplified98.7%
if -0.839999999999999969 < a < 8.9999999999999995e-15Initial program 99.4%
associate--l+99.4%
associate-+l+99.4%
+-commutative99.4%
associate-+r-99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in a around 0 99.3%
Final simplification99.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(log(Float64(x + y)) + Float64(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[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \log t \cdot \left(a + -0.5\right)
\end{array}
Initial program 99.6%
cancel-sign-sub99.6%
cancel-sign-sub-inv99.6%
associate--l+99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (+ (* (log t) (+ a -0.5)) (+ (log z) (- (log y) t))))
double code(double x, double y, double z, double t, double a) {
return (log(t) * (a + -0.5)) + (log(z) + (log(y) - 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(t) * (a + (-0.5d0))) + (log(z) + (log(y) - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(t) * (a + -0.5)) + (Math.log(z) + (Math.log(y) - t));
}
def code(x, y, z, t, a): return (math.log(t) * (a + -0.5)) + (math.log(z) + (math.log(y) - t))
function code(x, y, z, t, a) return Float64(Float64(log(t) * Float64(a + -0.5)) + Float64(log(z) + Float64(log(y) - t))) end
function tmp = code(x, y, z, t, a) tmp = (log(t) * (a + -0.5)) + (log(z) + (log(y) - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log t \cdot \left(a + -0.5\right) + \left(\log z + \left(\log y - t\right)\right)
\end{array}
Initial program 99.6%
cancel-sign-sub99.6%
cancel-sign-sub-inv99.6%
associate--l+99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 71.5%
remove-double-neg71.5%
log-rec71.5%
mul-1-neg71.5%
+-commutative71.5%
associate--l+71.5%
mul-1-neg71.5%
log-rec71.5%
remove-double-neg71.5%
Simplified71.5%
Final simplification71.5%
(FPCore (x y z t a) :precision binary64 (if (<= (+ x y) 2e+132) (- (+ (* (log t) (- a 0.5)) (log (* z y))) t) (+ (log (+ x y)) (- (* (log t) a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x + y) <= 2e+132) {
tmp = ((log(t) * (a - 0.5)) + log((z * y))) - t;
} else {
tmp = log((x + 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 ((x + y) <= 2d+132) then
tmp = ((log(t) * (a - 0.5d0)) + log((z * y))) - t
else
tmp = log((x + 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 ((x + y) <= 2e+132) {
tmp = ((Math.log(t) * (a - 0.5)) + Math.log((z * y))) - t;
} else {
tmp = Math.log((x + y)) + ((Math.log(t) * a) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x + y) <= 2e+132: tmp = ((math.log(t) * (a - 0.5)) + math.log((z * y))) - t else: tmp = math.log((x + y)) + ((math.log(t) * a) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(x + y) <= 2e+132) tmp = Float64(Float64(Float64(log(t) * Float64(a - 0.5)) + log(Float64(z * y))) - t); else tmp = Float64(log(Float64(x + y)) + Float64(Float64(log(t) * a) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x + y) <= 2e+132) tmp = ((log(t) * (a - 0.5)) + log((z * y))) - t; else tmp = log((x + y)) + ((log(t) * a) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x + y), $MachinePrecision], 2e+132], N[(N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 2 \cdot 10^{+132}:\\
\;\;\;\;\left(\log t \cdot \left(a - 0.5\right) + \log \left(z \cdot y\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log t \cdot a - t\right)\\
\end{array}
\end{array}
if (+.f64 x y) < 1.99999999999999998e132Initial program 99.4%
cancel-sign-sub99.4%
cancel-sign-sub-inv99.4%
associate--l+99.4%
remove-double-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
add-sqr-sqrt34.4%
pow234.4%
+-commutative34.4%
fma-def34.4%
associate-+r-34.4%
+-commutative34.4%
sum-log30.9%
Applied egg-rr30.9%
Taylor expanded in x around 0 58.7%
if 1.99999999999999998e132 < (+.f64 x y) Initial program 99.7%
associate--l+99.7%
associate-+l+99.8%
+-commutative99.8%
associate-+r-99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in a around inf 83.0%
*-commutative83.0%
Simplified83.0%
Final simplification70.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8.5e-12) (not (<= a 8.5e-24))) (+ (log (+ x y)) (- (* (log t) a) t)) (- (+ (* (log t) -0.5) (log (* z y))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8.5e-12) || !(a <= 8.5e-24)) {
tmp = log((x + y)) + ((log(t) * a) - t);
} else {
tmp = ((log(t) * -0.5) + log((z * y))) - 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 <= (-8.5d-12)) .or. (.not. (a <= 8.5d-24))) then
tmp = log((x + y)) + ((log(t) * a) - t)
else
tmp = ((log(t) * (-0.5d0)) + log((z * y))) - 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 <= -8.5e-12) || !(a <= 8.5e-24)) {
tmp = Math.log((x + y)) + ((Math.log(t) * a) - t);
} else {
tmp = ((Math.log(t) * -0.5) + Math.log((z * y))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -8.5e-12) or not (a <= 8.5e-24): tmp = math.log((x + y)) + ((math.log(t) * a) - t) else: tmp = ((math.log(t) * -0.5) + math.log((z * y))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8.5e-12) || !(a <= 8.5e-24)) tmp = Float64(log(Float64(x + y)) + Float64(Float64(log(t) * a) - t)); else tmp = Float64(Float64(Float64(log(t) * -0.5) + log(Float64(z * y))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -8.5e-12) || ~((a <= 8.5e-24))) tmp = log((x + y)) + ((log(t) * a) - t); else tmp = ((log(t) * -0.5) + log((z * y))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8.5e-12], N[Not[LessEqual[a, 8.5e-24]], $MachinePrecision]], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision] + N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.5 \cdot 10^{-12} \lor \neg \left(a \leq 8.5 \cdot 10^{-24}\right):\\
\;\;\;\;\log \left(x + y\right) + \left(\log t \cdot a - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log t \cdot -0.5 + \log \left(z \cdot y\right)\right) - t\\
\end{array}
\end{array}
if a < -8.4999999999999997e-12 or 8.5000000000000002e-24 < a Initial program 99.7%
associate--l+99.7%
associate-+l+99.7%
+-commutative99.7%
associate-+r-99.7%
fma-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 98.2%
*-commutative98.2%
Simplified98.2%
if -8.4999999999999997e-12 < a < 8.5000000000000002e-24Initial program 99.3%
associate--l+99.3%
associate-+l+99.4%
+-commutative99.4%
associate-+r-99.4%
fma-def99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in a around 0 99.3%
associate-+r+99.2%
log-prod70.3%
+-commutative70.3%
Simplified70.3%
Taylor expanded in y around inf 66.2%
associate-+r+66.2%
+-commutative66.2%
mul-1-neg66.2%
log-rec66.2%
remove-double-neg66.2%
log-prod50.2%
+-commutative50.2%
Simplified50.2%
Final simplification76.2%
(FPCore (x y z t a) :precision binary64 (if (<= t 6.8e-28) (+ (* (log t) (+ a -0.5)) (log (* z (+ x y)))) (+ (log (+ x y)) (- (* (log t) a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 6.8e-28) {
tmp = (log(t) * (a + -0.5)) + log((z * (x + y)));
} else {
tmp = log((x + 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 <= 6.8d-28) then
tmp = (log(t) * (a + (-0.5d0))) + log((z * (x + y)))
else
tmp = log((x + 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 <= 6.8e-28) {
tmp = (Math.log(t) * (a + -0.5)) + Math.log((z * (x + y)));
} else {
tmp = Math.log((x + y)) + ((Math.log(t) * a) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 6.8e-28: tmp = (math.log(t) * (a + -0.5)) + math.log((z * (x + y))) else: tmp = math.log((x + y)) + ((math.log(t) * a) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 6.8e-28) tmp = Float64(Float64(log(t) * Float64(a + -0.5)) + log(Float64(z * Float64(x + y)))); else tmp = Float64(log(Float64(x + y)) + Float64(Float64(log(t) * a) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 6.8e-28) tmp = (log(t) * (a + -0.5)) + log((z * (x + y))); else tmp = log((x + y)) + ((log(t) * a) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 6.8e-28], N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 6.8 \cdot 10^{-28}:\\
\;\;\;\;\log t \cdot \left(a + -0.5\right) + \log \left(z \cdot \left(x + y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log t \cdot a - t\right)\\
\end{array}
\end{array}
if t < 6.8000000000000001e-28Initial program 99.3%
cancel-sign-sub99.3%
cancel-sign-sub-inv99.3%
associate--l+99.3%
remove-double-neg99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in t around 0 99.3%
log-prod71.3%
+-commutative71.3%
Simplified71.3%
if 6.8000000000000001e-28 < t Initial program 99.8%
associate--l+99.8%
associate-+l+99.8%
+-commutative99.8%
associate-+r-99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in a around inf 94.1%
*-commutative94.1%
Simplified94.1%
Final simplification84.1%
(FPCore (x y z t a) :precision binary64 (if (<= t 2e+26) (+ (* (log t) (- a 0.5)) (log (* z x))) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2e+26) {
tmp = (log(t) * (a - 0.5)) + log((z * x));
} 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 <= 2d+26) then
tmp = (log(t) * (a - 0.5d0)) + log((z * x))
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 <= 2e+26) {
tmp = (Math.log(t) * (a - 0.5)) + Math.log((z * x));
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2e+26: tmp = (math.log(t) * (a - 0.5)) + math.log((z * x)) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2e+26) tmp = Float64(Float64(log(t) * Float64(a - 0.5)) + log(Float64(z * x))); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 2e+26) tmp = (log(t) * (a - 0.5)) + log((z * x)); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2e+26], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(z * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2 \cdot 10^{+26}:\\
\;\;\;\;\log t \cdot \left(a - 0.5\right) + \log \left(z \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 2.0000000000000001e26Initial program 99.2%
cancel-sign-sub99.2%
cancel-sign-sub-inv99.2%
associate--l+99.2%
remove-double-neg99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
add-sqr-sqrt60.7%
pow260.7%
+-commutative60.7%
fma-def60.7%
associate-+r-60.7%
+-commutative60.7%
sum-log40.6%
Applied egg-rr40.6%
Taylor expanded in y around 0 24.1%
Taylor expanded in t around 0 43.7%
if 2.0000000000000001e26 < t Initial program 100.0%
associate--l+100.0%
associate-+l+100.0%
+-commutative100.0%
associate-+r-100.0%
fma-def100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t around inf 80.8%
neg-mul-180.8%
Simplified80.8%
Final simplification60.2%
(FPCore (x y z t a) :precision binary64 (+ (log (+ x y)) (- (* (log t) a) t)))
double code(double x, double y, double z, double t, double a) {
return log((x + 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((x + y)) + ((log(t) * a) - t)
end function
public static double code(double x, double y, double z, double t, double a) {
return Math.log((x + y)) + ((Math.log(t) * a) - t);
}
def code(x, y, z, t, a): return math.log((x + y)) + ((math.log(t) * a) - t)
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + Float64(Float64(log(t) * a) - t)) end
function tmp = code(x, y, z, t, a) tmp = log((x + y)) + ((log(t) * a) - t); end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \left(\log t \cdot a - t\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
associate-+l+99.6%
+-commutative99.6%
associate-+r-99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in a around inf 78.0%
*-commutative78.0%
Simplified78.0%
Final simplification78.0%
(FPCore (x y z t a) :precision binary64 (- (log z) t))
double code(double x, double y, double z, double t, double a) {
return log(z) - t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = log(z) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return Math.log(z) - t;
}
def code(x, y, z, t, a): return math.log(z) - t
function code(x, y, z, t, a) return Float64(log(z) - t) end
function tmp = code(x, y, z, t, a) tmp = log(z) - t; end
code[x_, y_, z_, t_, a_] := N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log z - t
\end{array}
Initial program 99.6%
associate--l+99.6%
associate-+l+99.6%
+-commutative99.6%
associate-+r-99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in t around 0 99.6%
Taylor expanded in t around inf 41.2%
neg-mul-141.2%
Simplified41.2%
Final simplification41.2%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.6%
associate--l+99.6%
associate-+l+99.6%
+-commutative99.6%
associate-+r-99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in t around inf 38.0%
neg-mul-138.0%
Simplified38.0%
Final simplification38.0%
(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 2023291
(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))))