
(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 (fma (+ a -0.5) (log t) (+ (log (+ x y)) (- (log z) t))))
double code(double x, double y, double z, double t, double a) {
return fma((a + -0.5), log(t), (log((x + y)) + (log(z) - t)));
}
function code(x, y, z, t, a) return fma(Float64(a + -0.5), log(t), Float64(log(Float64(x + y)) + Float64(log(z) - t))) end
code[x_, y_, z_, t_, a_] := N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a + -0.5, \log t, \log \left(x + y\right) + \left(\log z - t\right)\right)
\end{array}
Initial program 99.6%
+-commutative99.6%
fma-def99.7%
sub-neg99.7%
metadata-eval99.7%
associate--l+99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= (- a 0.5) -2000000.0) (not (<= (- a 0.5) 0.4))) (- (* a (log t)) t) (- (+ (log y) (+ (log z) (* -0.5 (log t)))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a - 0.5) <= -2000000.0) || !((a - 0.5) <= 0.4)) {
tmp = (a * log(t)) - t;
} else {
tmp = (log(y) + (log(z) + (-0.5 * 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 (((a - 0.5d0) <= (-2000000.0d0)) .or. (.not. ((a - 0.5d0) <= 0.4d0))) then
tmp = (a * log(t)) - t
else
tmp = (log(y) + (log(z) + ((-0.5d0) * 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 (((a - 0.5) <= -2000000.0) || !((a - 0.5) <= 0.4)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = (Math.log(y) + (Math.log(z) + (-0.5 * Math.log(t)))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((a - 0.5) <= -2000000.0) or not ((a - 0.5) <= 0.4): tmp = (a * math.log(t)) - t else: tmp = (math.log(y) + (math.log(z) + (-0.5 * math.log(t)))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(a - 0.5) <= -2000000.0) || !(Float64(a - 0.5) <= 0.4)) tmp = Float64(Float64(a * log(t)) - t); else tmp = Float64(Float64(log(y) + Float64(log(z) + Float64(-0.5 * log(t)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((a - 0.5) <= -2000000.0) || ~(((a - 0.5) <= 0.4))) tmp = (a * log(t)) - t; else tmp = (log(y) + (log(z) + (-0.5 * log(t)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -2000000.0], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], 0.4]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -2000000 \lor \neg \left(a - 0.5 \leq 0.4\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log y + \left(\log z + -0.5 \cdot \log t\right)\right) - t\\
\end{array}
\end{array}
if (-.f64 a 1/2) < -2e6 or 0.40000000000000002 < (-.f64 a 1/2) 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 x around 0 70.6%
Taylor expanded in a around inf 98.3%
*-commutative98.3%
Simplified98.3%
if -2e6 < (-.f64 a 1/2) < 0.40000000000000002Initial program 99.5%
associate--l+99.5%
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 61.9%
Taylor expanded in a around 0 61.6%
*-commutative61.6%
Simplified61.6%
Final simplification80.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= (- a 0.5) -2000000.0) (not (<= (- a 0.5) 0.4))) (- (* a (log t)) t) (- (+ (log z) (log (* y (pow t -0.5)))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a - 0.5) <= -2000000.0) || !((a - 0.5) <= 0.4)) {
tmp = (a * log(t)) - t;
} else {
tmp = (log(z) + log((y * pow(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) :: tmp
if (((a - 0.5d0) <= (-2000000.0d0)) .or. (.not. ((a - 0.5d0) <= 0.4d0))) then
tmp = (a * log(t)) - t
else
tmp = (log(z) + log((y * (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 tmp;
if (((a - 0.5) <= -2000000.0) || !((a - 0.5) <= 0.4)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = (Math.log(z) + Math.log((y * Math.pow(t, -0.5)))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((a - 0.5) <= -2000000.0) or not ((a - 0.5) <= 0.4): tmp = (a * math.log(t)) - t else: tmp = (math.log(z) + math.log((y * math.pow(t, -0.5)))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(a - 0.5) <= -2000000.0) || !(Float64(a - 0.5) <= 0.4)) tmp = Float64(Float64(a * log(t)) - t); else tmp = Float64(Float64(log(z) + log(Float64(y * (t ^ -0.5)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((a - 0.5) <= -2000000.0) || ~(((a - 0.5) <= 0.4))) tmp = (a * log(t)) - t; else tmp = (log(z) + log((y * (t ^ -0.5)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -2000000.0], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], 0.4]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] + N[Log[N[(y * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -2000000 \lor \neg \left(a - 0.5 \leq 0.4\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z + \log \left(y \cdot {t}^{-0.5}\right)\right) - t\\
\end{array}
\end{array}
if (-.f64 a 1/2) < -2e6 or 0.40000000000000002 < (-.f64 a 1/2) 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 x around 0 70.6%
Taylor expanded in a around inf 98.3%
*-commutative98.3%
Simplified98.3%
if -2e6 < (-.f64 a 1/2) < 0.40000000000000002Initial program 99.5%
associate--l+99.5%
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 0 98.5%
Taylor expanded in z around inf 98.5%
associate-+r+98.6%
+-commutative98.6%
mul-1-neg98.6%
log-rec98.6%
remove-double-neg98.6%
log-prod76.6%
+-commutative76.6%
log-pow76.6%
log-prod69.8%
*-commutative69.8%
Simplified69.8%
Taylor expanded in y around inf 43.1%
associate-*r*42.5%
log-prod51.8%
Applied egg-rr51.8%
Final simplification76.2%
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (log t) (- a 0.5))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + (log(t) * (a - 0.5));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + (log(t) * (a - 0.5d0))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + (Math.log(t) * (a - 0.5));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + (math.log(t) * (a - 0.5))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(log(t) * Float64(a - 0.5))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + (log(t) * (a - 0.5)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \log t \cdot \left(a - 0.5\right)
\end{array}
Initial program 99.6%
Final simplification99.6%
(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.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 x around 0 66.5%
Final simplification66.5%
(FPCore (x y z t a) :precision binary64 (if (<= z 3.1e+97) (+ (log (* (+ x y) z)) (- (* (+ a -0.5) (log t)) t)) (+ (log (+ x y)) (fma (log t) a (- t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 3.1e+97) {
tmp = log(((x + y) * z)) + (((a + -0.5) * log(t)) - t);
} else {
tmp = log((x + y)) + fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= 3.1e+97) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(Float64(Float64(a + -0.5) * log(t)) - t)); else tmp = Float64(log(Float64(x + y)) + fma(log(t), a, Float64(-t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 3.1e+97], N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.1 \cdot 10^{+97}:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \left(\left(a + -0.5\right) \cdot \log t - t\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if z < 3.09999999999999981e97Initial program 99.5%
associate-+l-99.5%
+-commutative99.5%
sum-log91.1%
sub-neg91.1%
metadata-eval91.1%
Applied egg-rr91.1%
if 3.09999999999999981e97 < z 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 82.9%
*-commutative82.9%
Simplified82.9%
Taylor expanded in t around 0 82.9%
neg-mul-182.9%
+-commutative82.9%
+-commutative82.9%
*-commutative82.9%
fma-udef82.9%
Simplified82.9%
Final simplification88.0%
(FPCore (x y z t a) :precision binary64 (if (<= z 2.2e+97) (+ (log (* (+ x y) z)) (- (* (+ a -0.5) (log t)) t)) (- (+ (log y) (* a (log t))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 2.2e+97) {
tmp = log(((x + y) * z)) + (((a + -0.5) * log(t)) - t);
} else {
tmp = (log(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 (z <= 2.2d+97) then
tmp = log(((x + y) * z)) + (((a + (-0.5d0)) * log(t)) - t)
else
tmp = (log(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 (z <= 2.2e+97) {
tmp = Math.log(((x + y) * z)) + (((a + -0.5) * Math.log(t)) - t);
} else {
tmp = (Math.log(y) + (a * Math.log(t))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= 2.2e+97: tmp = math.log(((x + y) * z)) + (((a + -0.5) * math.log(t)) - t) else: tmp = (math.log(y) + (a * math.log(t))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= 2.2e+97) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(Float64(Float64(a + -0.5) * log(t)) - t)); else tmp = Float64(Float64(log(y) + Float64(a * log(t))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= 2.2e+97) tmp = log(((x + y) * z)) + (((a + -0.5) * log(t)) - t); else tmp = (log(y) + (a * log(t))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 2.2e+97], N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.2 \cdot 10^{+97}:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \left(\left(a + -0.5\right) \cdot \log t - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log y + a \cdot \log t\right) - t\\
\end{array}
\end{array}
if z < 2.2000000000000001e97Initial program 99.5%
associate-+l-99.5%
+-commutative99.5%
sum-log91.1%
sub-neg91.1%
metadata-eval91.1%
Applied egg-rr91.1%
if 2.2000000000000001e97 < z 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 82.9%
*-commutative82.9%
Simplified82.9%
Taylor expanded in x around 0 62.0%
Final simplification80.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* a (log t))))
(if (<= a -0.00088)
(- t_1 t)
(if (<= a 6e-45)
(- (+ (* -0.5 (log t)) (log (* y z))) t)
(- (+ (log y) t_1) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a * log(t);
double tmp;
if (a <= -0.00088) {
tmp = t_1 - t;
} else if (a <= 6e-45) {
tmp = ((-0.5 * log(t)) + log((y * z))) - t;
} else {
tmp = (log(y) + t_1) - 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 = a * log(t)
if (a <= (-0.00088d0)) then
tmp = t_1 - t
else if (a <= 6d-45) then
tmp = (((-0.5d0) * log(t)) + log((y * z))) - t
else
tmp = (log(y) + t_1) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a * Math.log(t);
double tmp;
if (a <= -0.00088) {
tmp = t_1 - t;
} else if (a <= 6e-45) {
tmp = ((-0.5 * Math.log(t)) + Math.log((y * z))) - t;
} else {
tmp = (Math.log(y) + t_1) - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a * math.log(t) tmp = 0 if a <= -0.00088: tmp = t_1 - t elif a <= 6e-45: tmp = ((-0.5 * math.log(t)) + math.log((y * z))) - t else: tmp = (math.log(y) + t_1) - t return tmp
function code(x, y, z, t, a) t_1 = Float64(a * log(t)) tmp = 0.0 if (a <= -0.00088) tmp = Float64(t_1 - t); elseif (a <= 6e-45) tmp = Float64(Float64(Float64(-0.5 * log(t)) + log(Float64(y * z))) - t); else tmp = Float64(Float64(log(y) + t_1) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a * log(t); tmp = 0.0; if (a <= -0.00088) tmp = t_1 - t; elseif (a <= 6e-45) tmp = ((-0.5 * log(t)) + log((y * z))) - t; else tmp = (log(y) + t_1) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.00088], N[(t$95$1 - t), $MachinePrecision], If[LessEqual[a, 6e-45], N[(N[(N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + t$95$1), $MachinePrecision] - t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \log t\\
\mathbf{if}\;a \leq -0.00088:\\
\;\;\;\;t_1 - t\\
\mathbf{elif}\;a \leq 6 \cdot 10^{-45}:\\
\;\;\;\;\left(-0.5 \cdot \log t + \log \left(y \cdot z\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log y + t_1\right) - t\\
\end{array}
\end{array}
if a < -8.80000000000000031e-4Initial 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 x around 0 62.2%
Taylor expanded in a around inf 99.1%
*-commutative99.1%
Simplified99.1%
if -8.80000000000000031e-4 < a < 6.00000000000000022e-45Initial program 99.5%
associate--l+99.5%
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 60.9%
Taylor expanded in a around 0 60.9%
associate-+r+60.8%
log-prod50.4%
*-commutative50.4%
*-commutative50.4%
Simplified50.4%
if 6.00000000000000022e-45 < 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 92.6%
*-commutative92.6%
Simplified92.6%
Taylor expanded in x around 0 73.3%
Final simplification70.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.0013) (+ (* (log t) (- a 0.5)) (log (* (+ x y) z))) (- (+ (log y) (* a (log t))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.0013) {
tmp = (log(t) * (a - 0.5)) + log(((x + y) * z));
} else {
tmp = (log(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 (t <= 0.0013d0) then
tmp = (log(t) * (a - 0.5d0)) + log(((x + y) * z))
else
tmp = (log(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 (t <= 0.0013) {
tmp = (Math.log(t) * (a - 0.5)) + Math.log(((x + y) * z));
} else {
tmp = (Math.log(y) + (a * Math.log(t))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.0013: tmp = (math.log(t) * (a - 0.5)) + math.log(((x + y) * z)) else: tmp = (math.log(y) + (a * math.log(t))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.0013) tmp = Float64(Float64(log(t) * Float64(a - 0.5)) + log(Float64(Float64(x + y) * z))); else tmp = Float64(Float64(log(y) + Float64(a * log(t))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 0.0013) tmp = (log(t) * (a - 0.5)) + log(((x + y) * z)); else tmp = (log(y) + (a * log(t))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.0013], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.0013:\\
\;\;\;\;\log t \cdot \left(a - 0.5\right) + \log \left(\left(x + y\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log y + a \cdot \log t\right) - t\\
\end{array}
\end{array}
if t < 0.0012999999999999999Initial program 99.3%
add-cbrt-cube70.4%
pow370.5%
+-commutative70.5%
sub-neg70.5%
metadata-eval70.5%
fma-def70.5%
+-commutative70.5%
sum-log55.3%
Applied egg-rr55.3%
Taylor expanded in t around 0 75.7%
if 0.0012999999999999999 < 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.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in x around 0 70.1%
Final simplification72.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* a (log t))))
(if (<= a -3.5e-20)
(- (+ (log y) t_1) t)
(if (<= a 0.00055) (- (log (* y (* z (pow t -0.5)))) t) (- t_1 t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a * log(t);
double tmp;
if (a <= -3.5e-20) {
tmp = (log(y) + t_1) - t;
} else if (a <= 0.00055) {
tmp = log((y * (z * pow(t, -0.5)))) - t;
} else {
tmp = t_1 - 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 = a * log(t)
if (a <= (-3.5d-20)) then
tmp = (log(y) + t_1) - t
else if (a <= 0.00055d0) then
tmp = log((y * (z * (t ** (-0.5d0))))) - t
else
tmp = t_1 - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a * Math.log(t);
double tmp;
if (a <= -3.5e-20) {
tmp = (Math.log(y) + t_1) - t;
} else if (a <= 0.00055) {
tmp = Math.log((y * (z * Math.pow(t, -0.5)))) - t;
} else {
tmp = t_1 - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a * math.log(t) tmp = 0 if a <= -3.5e-20: tmp = (math.log(y) + t_1) - t elif a <= 0.00055: tmp = math.log((y * (z * math.pow(t, -0.5)))) - t else: tmp = t_1 - t return tmp
function code(x, y, z, t, a) t_1 = Float64(a * log(t)) tmp = 0.0 if (a <= -3.5e-20) tmp = Float64(Float64(log(y) + t_1) - t); elseif (a <= 0.00055) tmp = Float64(log(Float64(y * Float64(z * (t ^ -0.5)))) - t); else tmp = Float64(t_1 - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a * log(t); tmp = 0.0; if (a <= -3.5e-20) tmp = (log(y) + t_1) - t; elseif (a <= 0.00055) tmp = log((y * (z * (t ^ -0.5)))) - t; else tmp = t_1 - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.5e-20], N[(N[(N[Log[y], $MachinePrecision] + t$95$1), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[a, 0.00055], N[(N[Log[N[(y * N[(z * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision], N[(t$95$1 - t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \log t\\
\mathbf{if}\;a \leq -3.5 \cdot 10^{-20}:\\
\;\;\;\;\left(\log y + t_1\right) - t\\
\mathbf{elif}\;a \leq 0.00055:\\
\;\;\;\;\log \left(y \cdot \left(z \cdot {t}^{-0.5}\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;t_1 - t\\
\end{array}
\end{array}
if a < -3.50000000000000003e-20Initial 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 97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in x around 0 61.6%
if -3.50000000000000003e-20 < a < 5.50000000000000033e-4Initial program 99.5%
associate--l+99.5%
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 0 98.6%
Taylor expanded in z around inf 98.7%
associate-+r+98.7%
+-commutative98.7%
mul-1-neg98.7%
log-rec98.7%
remove-double-neg98.7%
log-prod77.6%
+-commutative77.6%
log-pow77.6%
log-prod71.4%
*-commutative71.4%
Simplified71.4%
Taylor expanded in y around inf 44.5%
Taylor expanded in y around 0 57.5%
log-prod61.0%
unpow1/261.0%
log-pow61.0%
*-commutative61.0%
log-rec61.0%
distribute-lft-neg-out61.0%
distribute-rgt-neg-in61.0%
metadata-eval61.0%
*-commutative61.0%
log-pow61.0%
log-prod57.5%
log-prod45.3%
*-commutative45.3%
Simplified45.3%
if 5.50000000000000033e-4 < a Initial program 99.8%
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 x around 0 80.2%
Taylor expanded in a around inf 97.4%
*-commutative97.4%
Simplified97.4%
Final simplification63.6%
(FPCore (x y z t a) :precision binary64 (- (+ (log y) (* a (log t))) t))
double code(double x, double y, double z, double t, double a) {
return (log(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(y) + (a * log(t))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(y) + (a * Math.log(t))) - t;
}
def code(x, y, z, t, a): return (math.log(y) + (a * math.log(t))) - t
function code(x, y, z, t, a) return Float64(Float64(log(y) + Float64(a * log(t))) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(y) + (a * log(t))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y + a \cdot \log t\right) - 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 a around inf 77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in x around 0 55.1%
Final simplification55.1%
(FPCore (x y z t a) :precision binary64 (- (log (+ x y)) t))
double code(double x, double y, double z, double t, double a) {
return log((x + 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((x + y)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return Math.log((x + y)) - t;
}
def code(x, y, z, t, a): return math.log((x + y)) - t
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) - t) end
function tmp = code(x, y, z, t, a) tmp = log((x + y)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) - 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 a around inf 77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in a around 0 39.0%
+-commutative39.0%
Simplified39.0%
Final simplification39.0%
(FPCore (x y z t a) :precision binary64 (- (* a (log t)) t))
double code(double x, double y, double z, double t, double a) {
return (a * log(t)) - t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (a * log(t)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (a * Math.log(t)) - t;
}
def code(x, y, z, t, a): return (a * math.log(t)) - t
function code(x, y, z, t, a) return Float64(Float64(a * log(t)) - t) end
function tmp = code(x, y, z, t, a) tmp = (a * log(t)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \log t - t
\end{array}
Initial program 99.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 x around 0 66.5%
Taylor expanded in a around inf 74.5%
*-commutative74.5%
Simplified74.5%
Final simplification74.5%
(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 35.8%
neg-mul-135.8%
Simplified35.8%
Final simplification35.8%
(FPCore (x y z t a) :precision binary64 (+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t)))))
double code(double x, double y, double z, double t, double a) {
return log((x + y)) + ((log(z) - t) + ((a - 0.5) * log(t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = log((x + y)) + ((log(z) - t) + ((a - 0.5d0) * log(t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return Math.log((x + y)) + ((Math.log(z) - t) + ((a - 0.5) * Math.log(t)));
}
def code(x, y, z, t, a): return math.log((x + y)) + ((math.log(z) - t) + ((a - 0.5) * math.log(t)))
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + Float64(Float64(log(z) - t) + Float64(Float64(a - 0.5) * log(t)))) end
function tmp = code(x, y, z, t, a) tmp = log((x + y)) + ((log(z) - t) + ((a - 0.5) * log(t))); end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \left(\left(\log z - t\right) + \left(a - 0.5\right) \cdot \log t\right)
\end{array}
herbie shell --seed 2023275
(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))))