
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
(FPCore (x y z t a) :precision binary64 (+ (- (log z) t) (fma (+ a -0.5) (log t) (log (+ x y)))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + fma((a + -0.5), log(t), log((x + y)));
}
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + fma(Float64(a + -0.5), log(t), log(Float64(x + y)))) end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \mathsf{fma}\left(a + -0.5, \log t, \log \left(x + y\right)\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.6%
+-commutative99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(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 (if (<= (log z) 165.0) (- (+ (* (+ a -0.5) (log t)) (log (* z (+ x y)))) t) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (log(z) <= 165.0) {
tmp = (((a + -0.5) * log(t)) + log((z * (x + y)))) - t;
} else {
tmp = (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) <= 165.0d0) then
tmp = (((a + (-0.5d0)) * log(t)) + log((z * (x + y)))) - t
else
tmp = (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) <= 165.0) {
tmp = (((a + -0.5) * Math.log(t)) + Math.log((z * (x + y)))) - t;
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.log(z) <= 165.0: tmp = (((a + -0.5) * math.log(t)) + math.log((z * (x + y)))) - t else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (log(z) <= 165.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)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (log(z) <= 165.0) tmp = (((a + -0.5) * log(t)) + log((z * (x + y)))) - t; else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Log[z], $MachinePrecision], 165.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] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log z \leq 165:\\
\;\;\;\;\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 - t\\
\end{array}
\end{array}
if (log.f64 z) < 165Initial program 99.5%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.5%
+-commutative99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
+-commutative99.5%
fma-udef99.5%
metadata-eval99.5%
sub-neg99.5%
associate-+r+99.5%
associate--l+99.5%
associate-+r-99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
sum-log95.2%
Applied egg-rr95.2%
if 165 < (log.f64 z) 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%
Taylor expanded in a around inf 99.7%
Taylor expanded in a around inf 74.5%
Final simplification87.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 380.0) (+ (log (+ x y)) (+ (log z) (* (log t) (- a 0.5)))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 380.0) {
tmp = log((x + y)) + (log(z) + (log(t) * (a - 0.5)));
} else {
tmp = (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 <= 380.0d0) then
tmp = log((x + y)) + (log(z) + (log(t) * (a - 0.5d0)))
else
tmp = (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 <= 380.0) {
tmp = Math.log((x + y)) + (Math.log(z) + (Math.log(t) * (a - 0.5)));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 380.0: tmp = math.log((x + y)) + (math.log(z) + (math.log(t) * (a - 0.5))) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 380.0) tmp = Float64(log(Float64(x + y)) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 380.0) tmp = log((x + y)) + (log(z) + (log(t) * (a - 0.5))); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 380.0], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 380:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 380Initial program 99.2%
associate--l+99.2%
associate-+l+99.2%
+-commutative99.2%
fma-def99.2%
remove-double-neg99.2%
remove-double-neg99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in t around 0 97.9%
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 a around inf 99.9%
Taylor expanded in a around inf 99.7%
Final simplification98.8%
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log z) (log (+ x y))) t) (* (log t) (- a 0.5))))
double code(double x, double y, double z, double t, double a) {
return ((log(z) + log((x + y))) - t) + (log(t) * (a - 0.5));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log(z) + log((x + y))) - t) + (log(t) * (a - 0.5d0))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log(z) + Math.log((x + y))) - t) + (Math.log(t) * (a - 0.5));
}
def code(x, y, z, t, a): return ((math.log(z) + math.log((x + y))) - t) + (math.log(t) * (a - 0.5))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(z) + log(Float64(x + y))) - t) + Float64(log(t) * Float64(a - 0.5))) end
function tmp = code(x, y, z, t, a) tmp = ((log(z) + log((x + y))) - t) + (log(t) * (a - 0.5)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[z], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log z + \log \left(x + y\right)\right) - t\right) + \log t \cdot \left(a - 0.5\right)
\end{array}
Initial program 99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 350.0) (+ (* (log t) (- a 0.5)) (+ (log z) (log y))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 350.0) {
tmp = (log(t) * (a - 0.5)) + (log(z) + log(y));
} else {
tmp = (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 <= 350.0d0) then
tmp = (log(t) * (a - 0.5d0)) + (log(z) + log(y))
else
tmp = (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 <= 350.0) {
tmp = (Math.log(t) * (a - 0.5)) + (Math.log(z) + Math.log(y));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 350.0: tmp = (math.log(t) * (a - 0.5)) + (math.log(z) + math.log(y)) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 350.0) tmp = Float64(Float64(log(t) * Float64(a - 0.5)) + Float64(log(z) + log(y))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 350.0) tmp = (log(t) * (a - 0.5)) + (log(z) + log(y)); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 350.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] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 350:\\
\;\;\;\;\log t \cdot \left(a - 0.5\right) + \left(\log z + \log y\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 350Initial program 99.2%
associate--l+99.2%
associate-+l+99.2%
+-commutative99.2%
fma-def99.2%
remove-double-neg99.2%
remove-double-neg99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in t around 0 97.9%
Taylor expanded in x around 0 64.1%
if 350 < 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 a around inf 99.9%
Taylor expanded in a around inf 99.7%
Final simplification82.9%
(FPCore (x y z t a) :precision binary64 (+ (- (log z) t) (+ (* (log t) (- a 0.5)) (log y))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + ((log(t) * (a - 0.5)) + log(y));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (log(z) - t) + ((log(t) * (a - 0.5d0)) + log(y))
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(z) - t) + ((Math.log(t) * (a - 0.5)) + Math.log(y));
}
def code(x, y, z, t, a): return (math.log(z) - t) + ((math.log(t) * (a - 0.5)) + math.log(y))
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + Float64(Float64(log(t) * Float64(a - 0.5)) + log(y))) end
function tmp = code(x, y, z, t, a) tmp = (log(z) - t) + ((log(t) * (a - 0.5)) + log(y)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \left(\log t \cdot \left(a - 0.5\right) + \log y\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.6%
+-commutative99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 66.3%
Final simplification66.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= (- a 0.5) -200.0) (not (<= (- a 0.5) -0.4))) (- (* a (log t)) t) (- (+ (log (* z (+ x y))) (* -0.5 (log t))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a - 0.5) <= -200.0) || !((a - 0.5) <= -0.4)) {
tmp = (a * log(t)) - t;
} else {
tmp = (log((z * (x + y))) + (-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) <= (-200.0d0)) .or. (.not. ((a - 0.5d0) <= (-0.4d0)))) then
tmp = (a * log(t)) - t
else
tmp = (log((z * (x + y))) + ((-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) <= -200.0) || !((a - 0.5) <= -0.4)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = (Math.log((z * (x + y))) + (-0.5 * Math.log(t))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((a - 0.5) <= -200.0) or not ((a - 0.5) <= -0.4): tmp = (a * math.log(t)) - t else: tmp = (math.log((z * (x + y))) + (-0.5 * math.log(t))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(a - 0.5) <= -200.0) || !(Float64(a - 0.5) <= -0.4)) tmp = Float64(Float64(a * log(t)) - t); else tmp = Float64(Float64(log(Float64(z * Float64(x + y))) + 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) <= -200.0) || ~(((a - 0.5) <= -0.4))) tmp = (a * log(t)) - t; else tmp = (log((z * (x + y))) + (-0.5 * log(t))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -200.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[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -200 \lor \neg \left(a - 0.5 \leq -0.4\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + -0.5 \cdot \log t\right) - t\\
\end{array}
\end{array}
if (-.f64 a 1/2) < -200 or -0.40000000000000002 < (-.f64 a 1/2) 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%
Taylor expanded in a around inf 99.7%
Taylor expanded in a around inf 98.3%
if -200 < (-.f64 a 1/2) < -0.40000000000000002Initial 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 0 97.9%
associate-+r+97.9%
+-commutative97.9%
associate-+r+97.9%
+-commutative97.9%
associate-+r+97.9%
log-prod76.1%
+-commutative76.1%
Simplified76.1%
Final simplification88.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= (- a 0.5) -200.0) (not (<= (- a 0.5) -0.4))) (- (* a (log t)) t) (- (+ (* -0.5 (log t)) (log (* z y))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a - 0.5) <= -200.0) || !((a - 0.5) <= -0.4)) {
tmp = (a * log(t)) - t;
} else {
tmp = ((-0.5 * log(t)) + log((z * y))) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (((a - 0.5d0) <= (-200.0d0)) .or. (.not. ((a - 0.5d0) <= (-0.4d0)))) then
tmp = (a * log(t)) - t
else
tmp = (((-0.5d0) * log(t)) + log((z * y))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a - 0.5) <= -200.0) || !((a - 0.5) <= -0.4)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = ((-0.5 * Math.log(t)) + Math.log((z * y))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((a - 0.5) <= -200.0) or not ((a - 0.5) <= -0.4): tmp = (a * math.log(t)) - t else: tmp = ((-0.5 * math.log(t)) + math.log((z * y))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(a - 0.5) <= -200.0) || !(Float64(a - 0.5) <= -0.4)) tmp = Float64(Float64(a * log(t)) - t); else tmp = Float64(Float64(Float64(-0.5 * log(t)) + log(Float64(z * y))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((a - 0.5) <= -200.0) || ~(((a - 0.5) <= -0.4))) tmp = (a * log(t)) - t; else tmp = ((-0.5 * log(t)) + log((z * y))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -200.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[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -200 \lor \neg \left(a - 0.5 \leq -0.4\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\left(-0.5 \cdot \log t + \log \left(z \cdot y\right)\right) - t\\
\end{array}
\end{array}
if (-.f64 a 1/2) < -200 or -0.40000000000000002 < (-.f64 a 1/2) 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%
Taylor expanded in a around inf 99.7%
Taylor expanded in a around inf 98.3%
if -200 < (-.f64 a 1/2) < -0.40000000000000002Initial 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 99.4%
Taylor expanded in a around 0 97.9%
associate-+r+97.9%
metadata-eval97.9%
associate-*r*97.9%
mul-1-neg97.9%
log-rec97.9%
+-commutative97.9%
+-commutative97.9%
log-rec97.9%
mul-1-neg97.9%
associate-*r*97.9%
metadata-eval97.9%
*-commutative97.9%
log-prod76.1%
*-commutative76.1%
+-commutative76.1%
Simplified76.1%
Taylor expanded in x around 0 47.1%
*-commutative47.1%
Simplified47.1%
Final simplification74.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.7e-24) (+ (* (+ a -0.5) (log t)) (log (* z y))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.7e-24) {
tmp = ((a + -0.5) * log(t)) + log((z * y));
} else {
tmp = (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 <= 1.7d-24) then
tmp = ((a + (-0.5d0)) * log(t)) + log((z * y))
else
tmp = (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 <= 1.7e-24) {
tmp = ((a + -0.5) * Math.log(t)) + Math.log((z * y));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.7e-24: tmp = ((a + -0.5) * math.log(t)) + math.log((z * y)) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.7e-24) tmp = Float64(Float64(Float64(a + -0.5) * log(t)) + log(Float64(z * y))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.7e-24) tmp = ((a + -0.5) * log(t)) + log((z * y)); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.7e-24], N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.7 \cdot 10^{-24}:\\
\;\;\;\;\left(a + -0.5\right) \cdot \log t + \log \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 1.69999999999999996e-24Initial program 99.2%
associate--l+99.2%
associate-+l+99.2%
+-commutative99.2%
fma-def99.2%
remove-double-neg99.2%
remove-double-neg99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in t around 0 99.2%
Taylor expanded in x around 0 66.2%
Taylor expanded in t around inf 66.2%
log-prod49.0%
+-commutative49.0%
mul-1-neg49.0%
unsub-neg49.0%
log-rec49.0%
distribute-lft-neg-in49.0%
distribute-rgt-neg-in49.0%
sub-neg49.0%
metadata-eval49.0%
Simplified49.0%
if 1.69999999999999996e-24 < 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 a around inf 99.9%
Taylor expanded in a around inf 98.4%
Final simplification76.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 3.25e+50) (+ t (* a (log t))) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 3.25e+50) {
tmp = t + (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 <= 3.25d+50) then
tmp = t + (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 <= 3.25e+50) {
tmp = t + (a * Math.log(t));
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 3.25e+50: tmp = t + (a * math.log(t)) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 3.25e+50) tmp = Float64(t + 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 <= 3.25e+50) tmp = t + (a * log(t)); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 3.25e+50], N[(t + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.25 \cdot 10^{+50}:\\
\;\;\;\;t + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 3.2500000000000001e50Initial program 99.3%
associate--l+99.3%
associate-+l+99.3%
+-commutative99.3%
fma-def99.3%
remove-double-neg99.3%
remove-double-neg99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in a around inf 99.3%
Taylor expanded in a around inf 56.1%
*-commutative56.1%
fma-neg56.1%
Applied egg-rr56.1%
fma-udef56.1%
add-sqr-sqrt0.0%
sqrt-unprod52.0%
sqr-neg52.0%
sqrt-unprod52.1%
add-sqr-sqrt52.1%
Applied egg-rr52.1%
if 3.2500000000000001e50 < 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%
expm1-log1p-u7.6%
+-commutative7.6%
Applied egg-rr7.6%
Taylor expanded in t around inf 74.9%
mul-1-neg74.9%
Simplified74.9%
Final simplification62.5%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.8e+57) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.8e+57) {
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.8d+57) 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.8e+57) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.8e+57: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.8e+57) 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.8e+57) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.8e+57], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.8 \cdot 10^{+57}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 1.8000000000000001e57Initial program 99.3%
associate--l+99.3%
associate-+l+99.3%
+-commutative99.3%
fma-def99.3%
remove-double-neg99.3%
remove-double-neg99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in a around inf 99.3%
Taylor expanded in a around inf 57.3%
Taylor expanded in a around inf 51.9%
if 1.8000000000000001e57 < 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%
expm1-log1p-u7.1%
+-commutative7.1%
Applied egg-rr7.1%
Taylor expanded in t around inf 75.8%
mul-1-neg75.8%
Simplified75.8%
Final simplification62.5%
(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%
fma-def99.6%
remove-double-neg99.6%
remove-double-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in a around inf 99.6%
Taylor expanded in a around inf 76.1%
Final simplification76.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%
expm1-log1p-u33.0%
+-commutative33.0%
Applied egg-rr33.0%
Taylor expanded in t around inf 37.7%
mul-1-neg37.7%
Simplified37.7%
Final simplification37.7%
(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 2023196
(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))))