
(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 16 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%
+-commutative99.6%
associate--l+99.6%
associate-+r+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
(FPCore (x y z t a) :precision binary64 (if (<= (log z) 50.0) (+ (* (+ a -0.5) (log t)) (- (log (* z (+ x y))) t)) (- (+ (log y) (* a (log t))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (log(z) <= 50.0) {
tmp = ((a + -0.5) * log(t)) + (log((z * (x + y))) - 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 (log(z) <= 50.0d0) then
tmp = ((a + (-0.5d0)) * log(t)) + (log((z * (x + y))) - 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 (Math.log(z) <= 50.0) {
tmp = ((a + -0.5) * Math.log(t)) + (Math.log((z * (x + y))) - t);
} else {
tmp = (Math.log(y) + (a * Math.log(t))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.log(z) <= 50.0: tmp = ((a + -0.5) * math.log(t)) + (math.log((z * (x + y))) - t) else: tmp = (math.log(y) + (a * math.log(t))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (log(z) <= 50.0) tmp = Float64(Float64(Float64(a + -0.5) * log(t)) + Float64(log(Float64(z * Float64(x + y))) - 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 (log(z) <= 50.0) tmp = ((a + -0.5) * log(t)) + (log((z * (x + y))) - t); else tmp = (log(y) + (a * log(t))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Log[z], $MachinePrecision], 50.0], N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $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}\;\log z \leq 50:\\
\;\;\;\;\left(a + -0.5\right) \cdot \log t + \left(\log \left(z \cdot \left(x + y\right)\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log y + a \cdot \log t\right) - t\\
\end{array}
\end{array}
if (log.f64 z) < 50Initial program 99.5%
associate--l+99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
associate-+r-99.5%
sum-log94.0%
Applied egg-rr94.0%
if 50 < (log.f64 z) Initial program 99.7%
+-commutative99.7%
associate--l+99.7%
associate-+r+99.7%
+-commutative99.7%
fma-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 65.8%
Taylor expanded in a around inf 65.0%
Taylor expanded in a around inf 55.8%
Final simplification76.5%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.43) (+ (log z) (+ (log (+ x y)) (* (+ a -0.5) (log t)))) (- (+ (log y) (+ (log z) (* a (log t)))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.43) {
tmp = log(z) + (log((x + y)) + ((a + -0.5) * log(t)));
} else {
tmp = (log(y) + (log(z) + (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.43d0) then
tmp = log(z) + (log((x + y)) + ((a + (-0.5d0)) * log(t)))
else
tmp = (log(y) + (log(z) + (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.43) {
tmp = Math.log(z) + (Math.log((x + y)) + ((a + -0.5) * Math.log(t)));
} else {
tmp = (Math.log(y) + (Math.log(z) + (a * Math.log(t)))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.43: tmp = math.log(z) + (math.log((x + y)) + ((a + -0.5) * math.log(t))) else: tmp = (math.log(y) + (math.log(z) + (a * math.log(t)))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.43) tmp = Float64(log(z) + Float64(log(Float64(x + y)) + Float64(Float64(a + -0.5) * log(t)))); else tmp = Float64(Float64(log(y) + Float64(log(z) + Float64(a * log(t)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 0.43) tmp = log(z) + (log((x + y)) + ((a + -0.5) * log(t))); else tmp = (log(y) + (log(z) + (a * log(t)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.43], N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.43:\\
\;\;\;\;\log z + \left(\log \left(x + y\right) + \left(a + -0.5\right) \cdot \log t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log y + \left(\log z + a \cdot \log t\right)\right) - t\\
\end{array}
\end{array}
if t < 0.429999999999999993Initial program 99.3%
associate--l+99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
add-cube-cbrt98.2%
pow398.3%
Applied egg-rr98.3%
Taylor expanded in t around 0 98.7%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
+-commutative98.7%
Simplified98.7%
if 0.429999999999999993 < t Initial program 99.9%
+-commutative99.9%
associate--l+99.9%
associate-+r+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 76.5%
Taylor expanded in a around inf 75.7%
Final simplification87.3%
(FPCore (x y z t a) :precision binary64 (if (<= (log z) 50.0) (- (+ (log (* z y)) (* (log t) (- a 0.5))) t) (- (+ (log y) (* a (log t))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (log(z) <= 50.0) {
tmp = (log((z * y)) + (log(t) * (a - 0.5))) - 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 (log(z) <= 50.0d0) then
tmp = (log((z * y)) + (log(t) * (a - 0.5d0))) - 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 (Math.log(z) <= 50.0) {
tmp = (Math.log((z * y)) + (Math.log(t) * (a - 0.5))) - t;
} else {
tmp = (Math.log(y) + (a * Math.log(t))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.log(z) <= 50.0: tmp = (math.log((z * y)) + (math.log(t) * (a - 0.5))) - t else: tmp = (math.log(y) + (a * math.log(t))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (log(z) <= 50.0) tmp = Float64(Float64(log(Float64(z * y)) + Float64(log(t) * Float64(a - 0.5))) - 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 (log(z) <= 50.0) tmp = (log((z * y)) + (log(t) * (a - 0.5))) - t; else tmp = (log(y) + (a * log(t))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Log[z], $MachinePrecision], 50.0], N[(N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $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}\;\log z \leq 50:\\
\;\;\;\;\left(\log \left(z \cdot y\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log y + a \cdot \log t\right) - t\\
\end{array}
\end{array}
if (log.f64 z) < 50Initial program 99.5%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-undefine99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
associate-+r-99.5%
fma-undefine99.5%
associate--r+99.5%
sum-log94.0%
Applied egg-rr94.0%
Taylor expanded in x around 0 62.9%
if 50 < (log.f64 z) Initial program 99.7%
+-commutative99.7%
associate--l+99.7%
associate-+r+99.7%
+-commutative99.7%
fma-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 65.8%
Taylor expanded in a around inf 65.0%
Taylor expanded in a around inf 55.8%
Final simplification59.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.43) (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) (- (+ (log y) (+ (log z) (* a (log t)))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.43) {
tmp = log(y) + (log(z) + (log(t) * (a - 0.5)));
} else {
tmp = (log(y) + (log(z) + (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.43d0) then
tmp = log(y) + (log(z) + (log(t) * (a - 0.5d0)))
else
tmp = (log(y) + (log(z) + (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.43) {
tmp = Math.log(y) + (Math.log(z) + (Math.log(t) * (a - 0.5)));
} else {
tmp = (Math.log(y) + (Math.log(z) + (a * Math.log(t)))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.43: tmp = math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5))) else: tmp = (math.log(y) + (math.log(z) + (a * math.log(t)))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.43) tmp = Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))); else tmp = Float64(Float64(log(y) + Float64(log(z) + Float64(a * log(t)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 0.43) tmp = log(y) + (log(z) + (log(t) * (a - 0.5))); else tmp = (log(y) + (log(z) + (a * log(t)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.43], N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.43:\\
\;\;\;\;\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log y + \left(\log z + a \cdot \log t\right)\right) - t\\
\end{array}
\end{array}
if t < 0.429999999999999993Initial program 99.3%
+-commutative99.3%
associate--l+99.3%
associate-+r+99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 60.0%
add-cbrt-cube59.8%
pow359.9%
Applied egg-rr59.9%
Taylor expanded in t around 0 59.3%
if 0.429999999999999993 < t Initial program 99.9%
+-commutative99.9%
associate--l+99.9%
associate-+r+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 76.5%
Taylor expanded in a around inf 75.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 400.0) (+ (log 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 <= 400.0) {
tmp = log(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 <= 400.0d0) then
tmp = log(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 <= 400.0) {
tmp = Math.log(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 <= 400.0: tmp = math.log(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 <= 400.0) tmp = Float64(log(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 <= 400.0) tmp = log(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, 400.0], N[(N[Log[y], $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 400:\\
\;\;\;\;\log y + \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 < 400Initial program 99.3%
+-commutative99.3%
associate--l+99.3%
associate-+r+99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 59.7%
add-cbrt-cube59.5%
pow359.5%
Applied egg-rr59.5%
Taylor expanded in t around 0 59.0%
if 400 < t Initial program 99.9%
+-commutative99.9%
associate--l+99.9%
associate-+r+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 77.0%
Taylor expanded in a around inf 77.0%
Taylor expanded in a around inf 98.2%
(FPCore (x y z t a) :precision binary64 (+ (+ (- (log z) t) (log (+ x y))) (* (+ a -0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log(z) - t) + log((x + y))) + ((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(z) - t) + log((x + y))) + ((a + (-0.5d0)) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log(z) - t) + Math.log((x + y))) + ((a + -0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log(z) - t) + math.log((x + y))) + ((a + -0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(z) - t) + log(Float64(x + y))) + Float64(Float64(a + -0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log(z) - t) + log((x + y))) + ((a + -0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log z - t\right) + \log \left(x + y\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 (- (+ (+ (log z) (log y)) (* (+ a -0.5) (log t))) t))
double code(double x, double y, double z, double t, double a) {
return ((log(z) + log(y)) + ((a + -0.5) * 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(z) + log(y)) + ((a + (-0.5d0)) * log(t))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log(z) + Math.log(y)) + ((a + -0.5) * Math.log(t))) - t;
}
def code(x, y, z, t, a): return ((math.log(z) + math.log(y)) + ((a + -0.5) * math.log(t))) - t
function code(x, y, z, t, a) return Float64(Float64(Float64(log(z) + log(y)) + Float64(Float64(a + -0.5) * log(t))) - t) end
function tmp = code(x, y, z, t, a) tmp = ((log(z) + log(y)) + ((a + -0.5) * log(t))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log z + \log y\right) + \left(a + -0.5\right) \cdot \log t\right) - t
\end{array}
Initial program 99.6%
+-commutative99.6%
associate--l+99.6%
associate-+r+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 68.2%
associate-+r+68.2%
sub-neg68.2%
metadata-eval68.2%
Simplified68.2%
Final simplification68.2%
(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%
+-commutative99.6%
associate--l+99.6%
associate-+r+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 68.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -7.5e-56) (not (<= a 5.6))) (- (+ (log y) (* a (log t))) t) (- (log (* y (* z (pow t (+ a -0.5))))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -7.5e-56) || !(a <= 5.6)) {
tmp = (log(y) + (a * log(t))) - t;
} else {
tmp = log((y * (z * pow(t, (a + -0.5))))) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-7.5d-56)) .or. (.not. (a <= 5.6d0))) then
tmp = (log(y) + (a * log(t))) - t
else
tmp = log((y * (z * (t ** (a + (-0.5d0)))))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -7.5e-56) || !(a <= 5.6)) {
tmp = (Math.log(y) + (a * Math.log(t))) - t;
} else {
tmp = Math.log((y * (z * Math.pow(t, (a + -0.5))))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -7.5e-56) or not (a <= 5.6): tmp = (math.log(y) + (a * math.log(t))) - t else: tmp = math.log((y * (z * math.pow(t, (a + -0.5))))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -7.5e-56) || !(a <= 5.6)) tmp = Float64(Float64(log(y) + Float64(a * log(t))) - t); else tmp = Float64(log(Float64(y * Float64(z * (t ^ Float64(a + -0.5))))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -7.5e-56) || ~((a <= 5.6))) tmp = (log(y) + (a * log(t))) - t; else tmp = log((y * (z * (t ^ (a + -0.5))))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -7.5e-56], N[Not[LessEqual[a, 5.6]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(y * N[(z * N[Power[t, N[(a + -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.5 \cdot 10^{-56} \lor \neg \left(a \leq 5.6\right):\\
\;\;\;\;\left(\log y + a \cdot \log t\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot \left(z \cdot {t}^{\left(a + -0.5\right)}\right)\right) - t\\
\end{array}
\end{array}
if a < -7.50000000000000041e-56 or 5.5999999999999996 < a Initial program 99.7%
+-commutative99.7%
associate--l+99.7%
associate-+r+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 69.4%
Taylor expanded in a around inf 69.4%
Taylor expanded in a around inf 67.4%
if -7.50000000000000041e-56 < a < 5.5999999999999996Initial program 99.5%
+-commutative99.5%
associate--l+99.5%
associate-+r+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 66.5%
*-un-lft-identity66.5%
add-log-exp50.0%
associate-+r+50.0%
exp-sum47.4%
sum-log47.6%
add-exp-log47.6%
sub-neg47.6%
metadata-eval47.6%
exp-to-pow47.7%
Applied egg-rr47.7%
*-lft-identity47.7%
associate-*l*48.4%
Simplified48.4%
Final simplification59.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.62) (not (<= a 5.6))) (- (* a (log t)) t) (+ (- (log z) t) (log (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.62) || !(a <= 5.6)) {
tmp = (a * log(t)) - t;
} else {
tmp = (log(z) - t) + log((x + y));
}
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.62d0)) .or. (.not. (a <= 5.6d0))) then
tmp = (a * log(t)) - t
else
tmp = (log(z) - t) + log((x + y))
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.62) || !(a <= 5.6)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = (Math.log(z) - t) + Math.log((x + y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -0.62) or not (a <= 5.6): tmp = (a * math.log(t)) - t else: tmp = (math.log(z) - t) + math.log((x + y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.62) || !(a <= 5.6)) tmp = Float64(Float64(a * log(t)) - t); else tmp = Float64(Float64(log(z) - t) + log(Float64(x + y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -0.62) || ~((a <= 5.6))) tmp = (a * log(t)) - t; else tmp = (log(z) - t) + log((x + y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.62], N[Not[LessEqual[a, 5.6]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.62 \lor \neg \left(a \leq 5.6\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + \log \left(x + y\right)\\
\end{array}
\end{array}
if a < -0.619999999999999996 or 5.5999999999999996 < a Initial program 99.7%
+-commutative99.7%
associate--l+99.7%
associate-+r+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 70.0%
Taylor expanded in a around inf 70.0%
Taylor expanded in a around inf 97.3%
if -0.619999999999999996 < a < 5.5999999999999996Initial program 99.6%
associate-+l-99.6%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in t around inf 62.3%
Final simplification80.1%
(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%
+-commutative99.6%
associate--l+99.6%
associate-+r+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 68.2%
Taylor expanded in a around inf 67.8%
Taylor expanded in a around inf 59.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 4.4e+74) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 4.4e+74) {
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 <= 4.4d+74) 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 <= 4.4e+74) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 4.4e+74: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 4.4e+74) 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 <= 4.4e+74) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 4.4e+74], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.4 \cdot 10^{+74}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 4.4000000000000002e74Initial program 99.4%
associate-+l-99.4%
associate--l+99.4%
sub-neg99.4%
+-commutative99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
fma-undefine99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
metadata-eval99.4%
metadata-eval99.4%
unsub-neg99.4%
Simplified99.4%
Taylor expanded in a around inf 54.9%
*-commutative54.9%
Simplified54.9%
if 4.4000000000000002e74 < t Initial program 100.0%
associate-+l-100.0%
associate--l+100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-undefine100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in t around inf 83.8%
neg-mul-183.8%
Simplified83.8%
Final simplification66.1%
(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%
+-commutative99.6%
associate--l+99.6%
associate-+r+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 68.2%
Taylor expanded in a around inf 67.8%
Taylor expanded in a around inf 76.3%
(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%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in t around inf 38.2%
neg-mul-138.2%
Simplified38.2%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
return t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = t
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return 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%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in t around inf 38.2%
neg-mul-138.2%
Simplified38.2%
add-sqr-sqrt0.0%
sqrt-unprod2.2%
sqr-neg2.2%
sqrt-unprod2.3%
add-sqr-sqrt2.3%
*-un-lft-identity2.3%
Applied egg-rr2.3%
*-lft-identity2.3%
Simplified2.3%
(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 2024137
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (+ (log (+ x y)) (+ (- (log z) t) (* (- a 1/2) (log t)))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))