
(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)) (fma (+ a -0.5) (log t) (- (log z) t))))
double code(double x, double y, double z, double t, double a) {
return log((x + y)) + fma((a + -0.5), log(t), (log(z) - t));
}
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + fma(Float64(a + -0.5), log(t), Float64(log(z) - t))) end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \mathsf{fma}\left(a + -0.5, \log t, \log z - t\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
associate-+l+99.6%
+-commutative99.6%
fma-def99.6%
remove-double-neg99.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 (+ 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(log(Float64(x + y)) + 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[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + -0.5\right) \cdot \log t
\end{array}
Initial program 99.6%
associate--l+99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 380.0) (+ (* (log t) (- a 0.5)) (+ (log z) (log y))) (+ (* a (log t)) (- (log y) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 380.0) {
tmp = (log(t) * (a - 0.5)) + (log(z) + log(y));
} else {
tmp = (a * log(t)) + (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 (t <= 380.0d0) then
tmp = (log(t) * (a - 0.5d0)) + (log(z) + log(y))
else
tmp = (a * log(t)) + (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 (t <= 380.0) {
tmp = (Math.log(t) * (a - 0.5)) + (Math.log(z) + Math.log(y));
} else {
tmp = (a * Math.log(t)) + (Math.log(y) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 380.0: tmp = (math.log(t) * (a - 0.5)) + (math.log(z) + math.log(y)) else: tmp = (a * math.log(t)) + (math.log(y) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 380.0) tmp = Float64(Float64(log(t) * Float64(a - 0.5)) + Float64(log(z) + log(y))); else tmp = Float64(Float64(a * log(t)) + Float64(log(y) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 380.0) tmp = (log(t) * (a - 0.5)) + (log(z) + log(y)); else tmp = (a * log(t)) + (log(y) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 380.0], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 380:\\
\;\;\;\;\log t \cdot \left(a - 0.5\right) + \left(\log z + \log y\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t + \left(\log y - t\right)\\
\end{array}
\end{array}
if t < 380Initial program 99.3%
associate--l+99.3%
associate-+l+99.3%
+-commutative99.3%
fma-def99.4%
remove-double-neg99.4%
remove-double-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 63.3%
associate-+r+63.3%
associate--l+63.3%
fma-def63.3%
sub-neg63.3%
metadata-eval63.3%
+-commutative63.3%
Simplified63.3%
Taylor expanded in t around 0 63.0%
if 380 < t Initial program 99.9%
associate--l+99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
remove-double-neg99.9%
remove-double-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 72.4%
associate-+r+72.4%
associate--l+72.4%
fma-def72.4%
sub-neg72.4%
metadata-eval72.4%
+-commutative72.4%
Simplified72.4%
Taylor expanded in a around inf 71.7%
*-commutative71.7%
Simplified71.7%
Final simplification67.3%
(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(Float64(log(t) * Float64(a - 0.5)) + Float64(log(z) + 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[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log t \cdot \left(a - 0.5\right) + \left(\log z + \log y\right)\right) - t
\end{array}
Initial program 99.6%
associate--l+99.6%
associate-+l+99.6%
+-commutative99.6%
fma-def99.6%
remove-double-neg99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 67.8%
Final simplification67.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 860000000.0) (- (+ (* (+ a -0.5) (log t)) (log (* z (+ x y)))) t) (+ (* a (log t)) (- (log y) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 860000000.0) {
tmp = (((a + -0.5) * log(t)) + log((z * (x + y)))) - t;
} else {
tmp = (a * log(t)) + (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 (t <= 860000000.0d0) then
tmp = (((a + (-0.5d0)) * log(t)) + log((z * (x + y)))) - t
else
tmp = (a * log(t)) + (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 (t <= 860000000.0) {
tmp = (((a + -0.5) * Math.log(t)) + Math.log((z * (x + y)))) - t;
} else {
tmp = (a * Math.log(t)) + (Math.log(y) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 860000000.0: tmp = (((a + -0.5) * math.log(t)) + math.log((z * (x + y)))) - t else: tmp = (a * math.log(t)) + (math.log(y) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 860000000.0) tmp = Float64(Float64(Float64(Float64(a + -0.5) * log(t)) + log(Float64(z * Float64(x + y)))) - t); else tmp = Float64(Float64(a * log(t)) + Float64(log(y) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 860000000.0) tmp = (((a + -0.5) * log(t)) + log((z * (x + y)))) - t; else tmp = (a * log(t)) + (log(y) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 860000000.0], N[(N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 860000000:\\
\;\;\;\;\left(\left(a + -0.5\right) \cdot \log t + \log \left(z \cdot \left(x + y\right)\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t + \left(\log y - t\right)\\
\end{array}
\end{array}
if t < 8.6e8Initial program 99.3%
associate--l+99.4%
associate-+l+99.3%
+-commutative99.3%
fma-def99.4%
remove-double-neg99.4%
remove-double-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
+-commutative99.4%
fma-udef99.3%
associate-+r+99.4%
+-commutative99.4%
associate-+r-99.3%
associate-+r-99.3%
sum-log84.9%
Applied egg-rr84.9%
if 8.6e8 < t Initial program 99.9%
associate--l+99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
remove-double-neg99.9%
remove-double-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 72.0%
associate-+r+72.0%
associate--l+72.0%
fma-def72.0%
sub-neg72.0%
metadata-eval72.0%
+-commutative72.0%
Simplified72.0%
Taylor expanded in a around inf 71.7%
*-commutative71.7%
Simplified71.7%
Final simplification78.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 19.0) (+ (* (+ a -0.5) (log t)) (log (* z (+ x y)))) (+ (* a (log t)) (- (log y) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 19.0) {
tmp = ((a + -0.5) * log(t)) + log((z * (x + y)));
} else {
tmp = (a * log(t)) + (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 (t <= 19.0d0) then
tmp = ((a + (-0.5d0)) * log(t)) + log((z * (x + y)))
else
tmp = (a * log(t)) + (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 (t <= 19.0) {
tmp = ((a + -0.5) * Math.log(t)) + Math.log((z * (x + y)));
} else {
tmp = (a * Math.log(t)) + (Math.log(y) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 19.0: tmp = ((a + -0.5) * math.log(t)) + math.log((z * (x + y))) else: tmp = (a * math.log(t)) + (math.log(y) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 19.0) tmp = Float64(Float64(Float64(a + -0.5) * log(t)) + log(Float64(z * Float64(x + y)))); else tmp = Float64(Float64(a * log(t)) + Float64(log(y) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 19.0) tmp = ((a + -0.5) * log(t)) + log((z * (x + y))); else tmp = (a * log(t)) + (log(y) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 19.0], N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 19:\\
\;\;\;\;\left(a + -0.5\right) \cdot \log t + \log \left(z \cdot \left(x + y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t + \left(\log y - t\right)\\
\end{array}
\end{array}
if t < 19Initial program 99.3%
associate--l+99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in t around 0 98.5%
+-commutative98.5%
log-prod84.1%
+-commutative84.1%
Simplified84.1%
if 19 < t Initial program 99.9%
associate--l+99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
remove-double-neg99.9%
remove-double-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 72.4%
associate-+r+72.4%
associate--l+72.4%
fma-def72.4%
sub-neg72.4%
metadata-eval72.4%
+-commutative72.4%
Simplified72.4%
Taylor expanded in a around inf 71.7%
*-commutative71.7%
Simplified71.7%
Final simplification78.1%
(FPCore (x y z t a) :precision binary64 (if (<= t 150.0) (+ (* (log t) (- a 0.5)) (log (* y z))) (+ (* a (log t)) (- (log y) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 150.0) {
tmp = (log(t) * (a - 0.5)) + log((y * z));
} else {
tmp = (a * log(t)) + (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 (t <= 150.0d0) then
tmp = (log(t) * (a - 0.5d0)) + log((y * z))
else
tmp = (a * log(t)) + (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 (t <= 150.0) {
tmp = (Math.log(t) * (a - 0.5)) + Math.log((y * z));
} else {
tmp = (a * Math.log(t)) + (Math.log(y) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 150.0: tmp = (math.log(t) * (a - 0.5)) + math.log((y * z)) else: tmp = (a * math.log(t)) + (math.log(y) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 150.0) tmp = Float64(Float64(log(t) * Float64(a - 0.5)) + log(Float64(y * z))); else tmp = Float64(Float64(a * log(t)) + Float64(log(y) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 150.0) tmp = (log(t) * (a - 0.5)) + log((y * z)); else tmp = (a * log(t)) + (log(y) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 150.0], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 150:\\
\;\;\;\;\log t \cdot \left(a - 0.5\right) + \log \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t + \left(\log y - t\right)\\
\end{array}
\end{array}
if t < 150Initial program 99.3%
associate--l+99.3%
associate-+l+99.3%
+-commutative99.3%
fma-def99.4%
remove-double-neg99.4%
remove-double-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in t around 0 98.5%
fma-def98.5%
+-commutative98.5%
log-prod84.2%
sub-neg84.2%
metadata-eval84.2%
+-commutative84.2%
*-commutative84.2%
+-commutative84.2%
Simplified84.2%
Taylor expanded in x around 0 50.0%
if 150 < t Initial program 99.9%
associate--l+99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
remove-double-neg99.9%
remove-double-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 72.4%
associate-+r+72.4%
associate--l+72.4%
fma-def72.4%
sub-neg72.4%
metadata-eval72.4%
+-commutative72.4%
Simplified72.4%
Taylor expanded in a around inf 71.7%
*-commutative71.7%
Simplified71.7%
Final simplification60.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 2e+34) (+ (log (+ x y)) (* a (log t))) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2e+34) {
tmp = log((x + y)) + (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 <= 2d+34) then
tmp = log((x + y)) + (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 <= 2e+34) {
tmp = Math.log((x + y)) + (a * Math.log(t));
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2e+34: tmp = math.log((x + y)) + (a * math.log(t)) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2e+34) tmp = Float64(log(Float64(x + y)) + 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 <= 2e+34) tmp = log((x + y)) + (a * log(t)); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2e+34], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2 \cdot 10^{+34}:\\
\;\;\;\;\log \left(x + y\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 1.99999999999999989e34Initial program 99.4%
associate--l+99.4%
associate-+l+99.4%
+-commutative99.4%
fma-def99.4%
remove-double-neg99.4%
remove-double-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in a around inf 56.0%
*-commutative56.0%
Simplified56.0%
if 1.99999999999999989e34 < t Initial program 99.9%
associate--l+99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
remove-double-neg99.9%
remove-double-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 72.2%
associate-+r+72.2%
associate--l+72.2%
fma-def72.2%
sub-neg72.2%
metadata-eval72.2%
+-commutative72.2%
Simplified72.2%
Taylor expanded in t around inf 79.7%
neg-mul-179.7%
Simplified79.7%
Final simplification66.0%
(FPCore (x y z t a) :precision binary64 (+ (* a (log t)) (- (log y) t)))
double code(double x, double y, double z, double t, double a) {
return (a * log(t)) + (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 = (a * log(t)) + (log(y) - t)
end function
public static double code(double x, double y, double z, double t, double a) {
return (a * Math.log(t)) + (Math.log(y) - t);
}
def code(x, y, z, t, a): return (a * math.log(t)) + (math.log(y) - t)
function code(x, y, z, t, a) return Float64(Float64(a * log(t)) + Float64(log(y) - t)) end
function tmp = code(x, y, z, t, a) tmp = (a * log(t)) + (log(y) - t); end
code[x_, y_, z_, t_, a_] := N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \log t + \left(\log y - t\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
associate-+l+99.6%
+-commutative99.6%
fma-def99.6%
remove-double-neg99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 67.8%
associate-+r+67.7%
associate--l+67.7%
fma-def67.7%
sub-neg67.7%
metadata-eval67.7%
+-commutative67.7%
Simplified67.7%
Taylor expanded in a around inf 56.1%
*-commutative56.1%
Simplified56.1%
Final simplification56.1%
(FPCore (x y z t a)
:precision binary64
(if (or (<= a -2.05e+106)
(not
(or (<= a -1.05e+51)
(and (not (<= a -1350000000.0)) (<= a 27000000000000.0)))))
(* a (log t))
(- (log y) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.05e+106) || !((a <= -1.05e+51) || (!(a <= -1350000000.0) && (a <= 27000000000000.0)))) {
tmp = a * log(t);
} else {
tmp = 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 <= (-2.05d+106)) .or. (.not. (a <= (-1.05d+51)) .or. (.not. (a <= (-1350000000.0d0))) .and. (a <= 27000000000000.0d0))) then
tmp = a * log(t)
else
tmp = 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 <= -2.05e+106) || !((a <= -1.05e+51) || (!(a <= -1350000000.0) && (a <= 27000000000000.0)))) {
tmp = a * Math.log(t);
} else {
tmp = Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.05e+106) or not ((a <= -1.05e+51) or (not (a <= -1350000000.0) and (a <= 27000000000000.0))): tmp = a * math.log(t) else: tmp = math.log(y) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.05e+106) || !((a <= -1.05e+51) || (!(a <= -1350000000.0) && (a <= 27000000000000.0)))) tmp = Float64(a * log(t)); else tmp = Float64(log(y) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2.05e+106) || ~(((a <= -1.05e+51) || (~((a <= -1350000000.0)) && (a <= 27000000000000.0))))) tmp = a * log(t); else tmp = log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.05e+106], N[Not[Or[LessEqual[a, -1.05e+51], And[N[Not[LessEqual[a, -1350000000.0]], $MachinePrecision], LessEqual[a, 27000000000000.0]]]], $MachinePrecision]], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.05 \cdot 10^{+106} \lor \neg \left(a \leq -1.05 \cdot 10^{+51} \lor \neg \left(a \leq -1350000000\right) \land a \leq 27000000000000\right):\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\log y - t\\
\end{array}
\end{array}
if a < -2.0500000000000001e106 or -1.0500000000000001e51 < a < -1.35e9 or 2.7e13 < a Initial program 99.7%
associate--l+99.7%
associate-+l+99.7%
+-commutative99.7%
fma-def99.7%
remove-double-neg99.7%
remove-double-neg99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
+-commutative99.7%
fma-udef99.7%
associate-+r+99.7%
+-commutative99.7%
fma-def99.7%
associate-+r-99.7%
sum-log85.3%
Applied egg-rr85.3%
Taylor expanded in a around inf 84.1%
*-commutative84.1%
Simplified84.1%
if -2.0500000000000001e106 < a < -1.0500000000000001e51 or -1.35e9 < a < 2.7e13Initial program 99.6%
associate--l+99.6%
associate-+l+99.6%
+-commutative99.6%
fma-def99.6%
remove-double-neg99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in t around inf 58.1%
neg-mul-158.1%
Simplified58.1%
add-cbrt-cube22.1%
unsub-neg22.1%
+-commutative22.1%
unsub-neg22.1%
+-commutative22.1%
unsub-neg22.1%
+-commutative22.1%
Applied egg-rr22.1%
associate-*l*22.1%
cube-unmult22.1%
Simplified22.1%
Taylor expanded in y around inf 41.6%
mul-1-neg41.6%
log-rec41.6%
remove-double-neg41.6%
Simplified41.6%
Final simplification59.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.0014) (log (+ x y)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.0014) {
tmp = log((x + y));
} else {
tmp = -t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 0.0014d0) then
tmp = log((x + y))
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.0014) {
tmp = Math.log((x + y));
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.0014: tmp = math.log((x + y)) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.0014) tmp = log(Float64(x + y)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 0.0014) tmp = log((x + y)); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.0014], N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.0014:\\
\;\;\;\;\log \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 0.00139999999999999999Initial program 99.3%
associate--l+99.3%
associate-+l+99.3%
+-commutative99.3%
fma-def99.4%
remove-double-neg99.4%
remove-double-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in t around inf 9.3%
neg-mul-19.3%
Simplified9.3%
Taylor expanded in t around 0 9.3%
if 0.00139999999999999999 < t Initial program 99.9%
associate--l+99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
remove-double-neg99.9%
remove-double-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 72.5%
associate-+r+72.5%
associate--l+72.5%
fma-def72.5%
sub-neg72.5%
metadata-eval72.5%
+-commutative72.5%
Simplified72.5%
Taylor expanded in t around inf 72.8%
neg-mul-172.8%
Simplified72.8%
Final simplification41.0%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.65e+34) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.65e+34) {
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 <= 1.65d+34) 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 <= 1.65e+34) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.65e+34: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.65e+34) 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 <= 1.65e+34) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.65e+34], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.65 \cdot 10^{+34}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 1.64999999999999994e34Initial program 99.4%
associate--l+99.4%
associate-+l+99.4%
+-commutative99.4%
fma-def99.4%
remove-double-neg99.4%
remove-double-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
+-commutative99.4%
fma-udef99.4%
associate-+r+99.4%
+-commutative99.4%
fma-def99.4%
associate-+r-99.4%
sum-log83.9%
Applied egg-rr83.9%
Taylor expanded in a around inf 50.9%
*-commutative50.9%
Simplified50.9%
if 1.64999999999999994e34 < t Initial program 99.9%
associate--l+99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
remove-double-neg99.9%
remove-double-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 72.2%
associate-+r+72.2%
associate--l+72.2%
fma-def72.2%
sub-neg72.2%
metadata-eval72.2%
+-commutative72.2%
Simplified72.2%
Taylor expanded in t around inf 79.7%
neg-mul-179.7%
Simplified79.7%
Final simplification63.1%
(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%
fma-def99.6%
remove-double-neg99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 67.8%
associate-+r+67.7%
associate--l+67.7%
fma-def67.7%
sub-neg67.7%
metadata-eval67.7%
+-commutative67.7%
Simplified67.7%
Taylor expanded in t around inf 37.8%
neg-mul-137.8%
Simplified37.8%
Final simplification37.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 2023230
(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))))