
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ 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}
Initial program 99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= (- a 0.5) -2e+16) (not (<= (- a 0.5) -0.4999998))) (+ (log (+ x y)) (- (* a (log t)) 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) <= -2e+16) || !((a - 0.5) <= -0.4999998)) {
tmp = log((x + y)) + ((a * log(t)) - t);
} else {
tmp = ((log(z) + log(y)) - t) + (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) <= (-2d+16)) .or. (.not. ((a - 0.5d0) <= (-0.4999998d0)))) then
tmp = log((x + y)) + ((a * log(t)) - t)
else
tmp = ((log(z) + log(y)) - t) + (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) <= -2e+16) || !((a - 0.5) <= -0.4999998)) {
tmp = Math.log((x + y)) + ((a * Math.log(t)) - t);
} else {
tmp = ((Math.log(z) + Math.log(y)) - t) + (Math.log(t) * -0.5);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((a - 0.5) <= -2e+16) or not ((a - 0.5) <= -0.4999998): tmp = math.log((x + y)) + ((a * math.log(t)) - t) else: tmp = ((math.log(z) + math.log(y)) - t) + (math.log(t) * -0.5) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(a - 0.5) <= -2e+16) || !(Float64(a - 0.5) <= -0.4999998)) tmp = Float64(log(Float64(x + y)) + Float64(Float64(a * log(t)) - t)); else tmp = Float64(Float64(Float64(log(z) + log(y)) - t) + 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) <= -2e+16) || ~(((a - 0.5) <= -0.4999998))) tmp = log((x + y)) + ((a * log(t)) - t); else tmp = ((log(z) + log(y)) - t) + (log(t) * -0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -2e+16], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], -0.4999998]], $MachinePrecision]], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - 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 -2 \cdot 10^{+16} \lor \neg \left(a - 0.5 \leq -0.4999998\right):\\
\;\;\;\;\log \left(x + y\right) + \left(a \cdot \log t - 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) < -2e16 or -0.49999979999999999 < (-.f64 a 1/2) 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 98.7%
*-commutative98.7%
Simplified98.7%
if -2e16 < (-.f64 a 1/2) < -0.49999979999999999Initial program 99.5%
add-cube-cbrt99.2%
pow399.2%
sub-neg99.2%
metadata-eval99.2%
Applied egg-rr99.2%
Taylor expanded in x around 0 61.3%
Taylor expanded in a around 0 61.1%
pow-base-161.1%
*-lft-identity61.1%
Simplified61.1%
Final simplification80.9%
(FPCore (x y z t a) :precision binary64 (if (<= (log z) 200.0) (+ (log (* (+ x y) z)) (- (* (log t) (+ a -0.5)) t)) (+ (log (+ x y)) (- (* a (log t)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (log(z) <= 200.0) {
tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t);
} else {
tmp = log((x + y)) + ((a * log(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) :: tmp
if (log(z) <= 200.0d0) then
tmp = log(((x + y) * z)) + ((log(t) * (a + (-0.5d0))) - t)
else
tmp = log((x + y)) + ((a * log(t)) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (Math.log(z) <= 200.0) {
tmp = Math.log(((x + y) * z)) + ((Math.log(t) * (a + -0.5)) - t);
} else {
tmp = Math.log((x + y)) + ((a * Math.log(t)) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.log(z) <= 200.0: tmp = math.log(((x + y) * z)) + ((math.log(t) * (a + -0.5)) - t) else: tmp = math.log((x + y)) + ((a * math.log(t)) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (log(z) <= 200.0) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(Float64(log(t) * Float64(a + -0.5)) - t)); else tmp = Float64(log(Float64(x + y)) + Float64(Float64(a * log(t)) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (log(z) <= 200.0) tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t); else tmp = log((x + y)) + ((a * log(t)) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Log[z], $MachinePrecision], 200.0], N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log z \leq 200:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \left(\log t \cdot \left(a + -0.5\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \left(a \cdot \log t - t\right)\\
\end{array}
\end{array}
if (log.f64 z) < 200Initial program 99.5%
associate-+l-99.5%
+-commutative99.5%
sum-log94.9%
sub-neg94.9%
metadata-eval94.9%
Applied egg-rr94.9%
if 200 < (log.f64 z) 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 77.9%
*-commutative77.9%
Simplified77.9%
Final simplification89.2%
(FPCore (x y z t a) :precision binary64 (if (<= (log z) 200.0) (- (+ (* (- a 0.5) (log t)) (log (* y z))) t) (+ (log (+ x y)) (- (* a (log t)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (log(z) <= 200.0) {
tmp = (((a - 0.5) * log(t)) + log((y * z))) - t;
} else {
tmp = log((x + y)) + ((a * log(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) :: tmp
if (log(z) <= 200.0d0) then
tmp = (((a - 0.5d0) * log(t)) + log((y * z))) - t
else
tmp = log((x + y)) + ((a * log(t)) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (Math.log(z) <= 200.0) {
tmp = (((a - 0.5) * Math.log(t)) + Math.log((y * z))) - t;
} else {
tmp = Math.log((x + y)) + ((a * Math.log(t)) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.log(z) <= 200.0: tmp = (((a - 0.5) * math.log(t)) + math.log((y * z))) - t else: tmp = math.log((x + y)) + ((a * math.log(t)) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (log(z) <= 200.0) tmp = Float64(Float64(Float64(Float64(a - 0.5) * log(t)) + log(Float64(y * z))) - t); else tmp = Float64(log(Float64(x + y)) + Float64(Float64(a * log(t)) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (log(z) <= 200.0) tmp = (((a - 0.5) * log(t)) + log((y * z))) - t; else tmp = log((x + y)) + ((a * log(t)) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Log[z], $MachinePrecision], 200.0], N[(N[(N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log z \leq 200:\\
\;\;\;\;\left(\left(a - 0.5\right) \cdot \log t + \log \left(y \cdot z\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \left(a \cdot \log t - t\right)\\
\end{array}
\end{array}
if (log.f64 z) < 200Initial program 99.5%
associate-+l-99.5%
+-commutative99.5%
sum-log94.9%
sub-neg94.9%
metadata-eval94.9%
Applied egg-rr94.9%
Taylor expanded in x around 0 58.8%
if 200 < (log.f64 z) 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 77.9%
*-commutative77.9%
Simplified77.9%
Final simplification65.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (log (+ x y))))
(if (<= t 0.00172)
(+ (+ t_1 (log z)) (* (- a 0.5) (log t)))
(+ t_1 (- (* a (log t)) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y));
double tmp;
if (t <= 0.00172) {
tmp = (t_1 + log(z)) + ((a - 0.5) * log(t));
} else {
tmp = t_1 + ((a * log(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))
if (t <= 0.00172d0) then
tmp = (t_1 + log(z)) + ((a - 0.5d0) * log(t))
else
tmp = t_1 + ((a * log(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));
double tmp;
if (t <= 0.00172) {
tmp = (t_1 + Math.log(z)) + ((a - 0.5) * Math.log(t));
} else {
tmp = t_1 + ((a * Math.log(t)) - t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((x + y)) tmp = 0 if t <= 0.00172: tmp = (t_1 + math.log(z)) + ((a - 0.5) * math.log(t)) else: tmp = t_1 + ((a * math.log(t)) - t) return tmp
function code(x, y, z, t, a) t_1 = log(Float64(x + y)) tmp = 0.0 if (t <= 0.00172) tmp = Float64(Float64(t_1 + log(z)) + Float64(Float64(a - 0.5) * log(t))); else tmp = Float64(t_1 + Float64(Float64(a * log(t)) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((x + y)); tmp = 0.0; if (t <= 0.00172) tmp = (t_1 + log(z)) + ((a - 0.5) * log(t)); else tmp = t_1 + ((a * log(t)) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 0.00172], N[(N[(t$95$1 + N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right)\\
\mathbf{if}\;t \leq 0.00172:\\
\;\;\;\;\left(t_1 + \log z\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(a \cdot \log t - t\right)\\
\end{array}
\end{array}
if t < 0.00171999999999999996Initial program 99.3%
Taylor expanded in t around 0 98.7%
if 0.00171999999999999996 < t Initial program 99.9%
associate--l+99.9%
associate-+l+99.9%
+-commutative99.9%
associate-+r-99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around inf 99.0%
*-commutative99.0%
Simplified99.0%
Final simplification98.9%
(FPCore (x y z t a) :precision binary64 (- (+ (+ (log z) (* (log t) (+ a -0.5))) (log y)) t))
double code(double x, double y, double z, double t, double a) {
return ((log(z) + (log(t) * (a + -0.5))) + 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(z) + (log(t) * (a + (-0.5d0)))) + log(y)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log(z) + (Math.log(t) * (a + -0.5))) + Math.log(y)) - t;
}
def code(x, y, z, t, a): return ((math.log(z) + (math.log(t) * (a + -0.5))) + math.log(y)) - t
function code(x, y, z, t, a) return Float64(Float64(Float64(log(z) + Float64(log(t) * Float64(a + -0.5))) + log(y)) - t) end
function tmp = code(x, y, z, t, a) tmp = ((log(z) + (log(t) * (a + -0.5))) + log(y)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log z + \log t \cdot \left(a + -0.5\right)\right) + \log y\right) - t
\end{array}
Initial program 99.6%
associate--l+99.6%
associate-+l+99.5%
+-commutative99.5%
associate-+r-99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 65.6%
associate--l+65.6%
associate--l+65.6%
remove-double-neg65.6%
log-rec65.6%
mul-1-neg65.6%
associate--l+65.6%
associate--l+65.6%
Simplified29.4%
*-commutative29.4%
log-prod31.4%
pow-to-exp31.4%
+-commutative31.4%
*-commutative31.4%
add-cube-cbrt31.3%
unpow331.3%
add-log-exp65.2%
unpow365.2%
add-cube-cbrt65.6%
*-commutative65.6%
Applied egg-rr65.6%
Final simplification65.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5e-11) (not (<= a 5.2e-9))) (+ (log (+ x y)) (- (* a (log t)) t)) (- (log (* y (* z (pow t (+ a -0.5))))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5e-11) || !(a <= 5.2e-9)) {
tmp = log((x + y)) + ((a * log(t)) - t);
} else {
tmp = log((y * (z * pow(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) :: tmp
if ((a <= (-5d-11)) .or. (.not. (a <= 5.2d-9))) then
tmp = log((x + y)) + ((a * log(t)) - t)
else
tmp = log((y * (z * (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 tmp;
if ((a <= -5e-11) || !(a <= 5.2e-9)) {
tmp = Math.log((x + y)) + ((a * Math.log(t)) - t);
} else {
tmp = Math.log((y * (z * Math.pow(t, (a + -0.5))))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5e-11) or not (a <= 5.2e-9): tmp = math.log((x + y)) + ((a * math.log(t)) - t) else: tmp = math.log((y * (z * math.pow(t, (a + -0.5))))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5e-11) || !(a <= 5.2e-9)) tmp = Float64(log(Float64(x + y)) + Float64(Float64(a * log(t)) - t)); else tmp = Float64(log(Float64(y * Float64(z * (t ^ Float64(a + -0.5))))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -5e-11) || ~((a <= 5.2e-9))) tmp = log((x + y)) + ((a * log(t)) - t); else tmp = log((y * (z * (t ^ (a + -0.5))))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5e-11], N[Not[LessEqual[a, 5.2e-9]], $MachinePrecision]], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(y * N[(z * N[Power[t, N[(a + -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5 \cdot 10^{-11} \lor \neg \left(a \leq 5.2 \cdot 10^{-9}\right):\\
\;\;\;\;\log \left(x + y\right) + \left(a \cdot \log t - t\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot \left(z \cdot {t}^{\left(a + -0.5\right)}\right)\right) - t\\
\end{array}
\end{array}
if a < -5.00000000000000018e-11 or 5.2000000000000002e-9 < a 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 98.2%
*-commutative98.2%
Simplified98.2%
if -5.00000000000000018e-11 < a < 5.2000000000000002e-9Initial program 99.5%
associate--l+99.5%
associate-+l+99.4%
+-commutative99.4%
associate-+r-99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 61.0%
associate--l+61.0%
associate--l+61.0%
remove-double-neg61.0%
log-rec61.0%
mul-1-neg61.0%
associate--l+61.0%
associate--l+61.0%
Simplified56.5%
sum-log43.0%
+-commutative43.0%
Applied egg-rr43.0%
Final simplification73.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -4.8e-12) (not (<= a 6.8e-9))) (+ (log (+ x y)) (- (* a (log t)) t)) (- (log (* y (* z (sqrt (/ 1.0 t))))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -4.8e-12) || !(a <= 6.8e-9)) {
tmp = log((x + y)) + ((a * log(t)) - t);
} else {
tmp = log((y * (z * sqrt((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) :: tmp
if ((a <= (-4.8d-12)) .or. (.not. (a <= 6.8d-9))) then
tmp = log((x + y)) + ((a * log(t)) - t)
else
tmp = log((y * (z * sqrt((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 tmp;
if ((a <= -4.8e-12) || !(a <= 6.8e-9)) {
tmp = Math.log((x + y)) + ((a * Math.log(t)) - t);
} else {
tmp = Math.log((y * (z * Math.sqrt((1.0 / t))))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -4.8e-12) or not (a <= 6.8e-9): tmp = math.log((x + y)) + ((a * math.log(t)) - t) else: tmp = math.log((y * (z * math.sqrt((1.0 / t))))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -4.8e-12) || !(a <= 6.8e-9)) tmp = Float64(log(Float64(x + y)) + Float64(Float64(a * log(t)) - t)); else tmp = Float64(log(Float64(y * Float64(z * sqrt(Float64(1.0 / t))))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -4.8e-12) || ~((a <= 6.8e-9))) tmp = log((x + y)) + ((a * log(t)) - t); else tmp = log((y * (z * sqrt((1.0 / t))))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -4.8e-12], N[Not[LessEqual[a, 6.8e-9]], $MachinePrecision]], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(y * N[(z * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.8 \cdot 10^{-12} \lor \neg \left(a \leq 6.8 \cdot 10^{-9}\right):\\
\;\;\;\;\log \left(x + y\right) + \left(a \cdot \log t - t\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot \left(z \cdot \sqrt{\frac{1}{t}}\right)\right) - t\\
\end{array}
\end{array}
if a < -4.79999999999999974e-12 or 6.7999999999999997e-9 < a 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 98.2%
*-commutative98.2%
Simplified98.2%
if -4.79999999999999974e-12 < a < 6.7999999999999997e-9Initial program 99.5%
associate--l+99.5%
associate-+l+99.4%
+-commutative99.4%
associate-+r-99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 61.0%
associate--l+61.0%
associate--l+61.0%
remove-double-neg61.0%
log-rec61.0%
mul-1-neg61.0%
associate--l+61.0%
associate--l+61.0%
Simplified56.5%
sum-log43.0%
+-commutative43.0%
Applied egg-rr43.0%
Taylor expanded in a around 0 42.7%
Final simplification72.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.8e+53) (not (<= a 5.8e+40))) (* a (log t)) (- (+ (log z) (log y)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.8e+53) || !(a <= 5.8e+40)) {
tmp = a * log(t);
} else {
tmp = (log(z) + log(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 <= (-1.8d+53)) .or. (.not. (a <= 5.8d+40))) then
tmp = a * log(t)
else
tmp = (log(z) + log(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 <= -1.8e+53) || !(a <= 5.8e+40)) {
tmp = a * Math.log(t);
} else {
tmp = (Math.log(z) + Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.8e+53) or not (a <= 5.8e+40): tmp = a * math.log(t) else: tmp = (math.log(z) + math.log(y)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.8e+53) || !(a <= 5.8e+40)) tmp = Float64(a * log(t)); else tmp = Float64(Float64(log(z) + log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.8e+53) || ~((a <= 5.8e+40))) tmp = a * log(t); else tmp = (log(z) + log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.8e+53], N[Not[LessEqual[a, 5.8e+40]], $MachinePrecision]], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.8 \cdot 10^{+53} \lor \neg \left(a \leq 5.8 \cdot 10^{+40}\right):\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z + \log y\right) - t\\
\end{array}
\end{array}
if a < -1.8e53 or 5.80000000000000035e40 < a Initial program 99.6%
associate-+l-99.6%
+-commutative99.6%
sum-log82.3%
sub-neg82.3%
metadata-eval82.3%
Applied egg-rr82.3%
rem-cube-cbrt81.4%
Applied egg-rr81.4%
rem-cube-cbrt82.3%
flip-+40.3%
associate-*l/40.3%
fma-neg40.3%
metadata-eval40.3%
metadata-eval40.3%
sub-neg40.3%
metadata-eval40.3%
Applied egg-rr40.3%
Taylor expanded in a around inf 81.9%
*-commutative81.9%
Simplified81.9%
if -1.8e53 < a < 5.80000000000000035e40Initial program 99.5%
add-cube-cbrt99.3%
pow399.3%
sub-neg99.3%
metadata-eval99.3%
Applied egg-rr99.3%
Taylor expanded in x around 0 61.3%
Taylor expanded in a around inf 43.8%
Final simplification61.3%
(FPCore (x y z t a) :precision binary64 (+ (log (+ x y)) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
return log((x + y)) + ((a * log(t)) - t);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = log((x + y)) + ((a * log(t)) - t)
end function
public static double code(double x, double y, double z, double t, double a) {
return Math.log((x + y)) + ((a * Math.log(t)) - t);
}
def code(x, y, z, t, a): return math.log((x + y)) + ((a * math.log(t)) - t)
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + Float64(Float64(a * log(t)) - t)) end
function tmp = code(x, y, z, t, a) tmp = log((x + y)) + ((a * log(t)) - t); end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \left(a \cdot \log t - t\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
associate-+l+99.5%
+-commutative99.5%
associate-+r-99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in a around inf 77.6%
*-commutative77.6%
Simplified77.6%
Final simplification77.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 580.0) (log (* y z)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 580.0) {
tmp = log((y * z));
} 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 <= 580.0d0) then
tmp = log((y * z))
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 <= 580.0) {
tmp = Math.log((y * z));
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 580.0: tmp = math.log((y * z)) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 580.0) tmp = log(Float64(y * z)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 580.0) tmp = log((y * z)); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 580.0], N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 580:\\
\;\;\;\;\log \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 580Initial program 99.3%
add-cube-cbrt98.4%
pow398.4%
sub-neg98.4%
metadata-eval98.4%
Applied egg-rr98.4%
Taylor expanded in x around 0 57.0%
Taylor expanded in a around inf 6.1%
log-prod5.6%
Simplified5.6%
Taylor expanded in t around 0 5.6%
if 580 < t Initial program 99.9%
associate--l+99.9%
associate-+l+99.9%
+-commutative99.9%
associate-+r-99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 73.5%
neg-mul-173.5%
Simplified73.5%
Final simplification37.9%
(FPCore (x y z t a) :precision binary64 (if (<= t 5.5e+27) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5.5e+27) {
tmp = a * log(t);
} else {
tmp = -t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 5.5d+27) then
tmp = a * log(t)
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5.5e+27) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 5.5e+27: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 5.5e+27) tmp = Float64(a * log(t)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 5.5e+27) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 5.5e+27], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5.5 \cdot 10^{+27}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 5.49999999999999966e27Initial program 99.3%
associate-+l-99.3%
+-commutative99.3%
sum-log81.1%
sub-neg81.1%
metadata-eval81.1%
Applied egg-rr81.1%
rem-cube-cbrt80.2%
Applied egg-rr80.2%
rem-cube-cbrt81.1%
flip-+60.4%
associate-*l/60.4%
fma-neg60.4%
metadata-eval60.4%
metadata-eval60.4%
sub-neg60.4%
metadata-eval60.4%
Applied egg-rr60.4%
Taylor expanded in a around inf 53.0%
*-commutative53.0%
Simplified53.0%
if 5.49999999999999966e27 < t Initial program 99.9%
associate--l+99.9%
associate-+l+99.9%
+-commutative99.9%
associate-+r-99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 77.5%
neg-mul-177.5%
Simplified77.5%
Final simplification63.8%
(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.5%
+-commutative99.5%
associate-+r-99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in t around inf 36.5%
neg-mul-136.5%
Simplified36.5%
Final simplification36.5%
(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 2023274
(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))))