
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
(FPCore (x y z t a) :precision binary64 (+ (log (+ x y)) (- (log z) (fma (log t) (- 0.5 a) t))))
double code(double x, double y, double z, double t, double a) {
return log((x + y)) + (log(z) - fma(log(t), (0.5 - a), t));
}
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + Float64(log(z) - fma(log(t), Float64(0.5 - a), t))) end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * N[(0.5 - a), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, 0.5 - a, t\right)\right)
\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%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (<= (+ (log (+ x y)) (log z)) 710.0) (+ (log (* (+ x y) z)) (- (* (log t) (+ a -0.5)) t)) (- (* (log t) a) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((log((x + y)) + log(z)) <= 710.0) {
tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t);
} else {
tmp = (log(t) * a) - 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((x + y)) + log(z)) <= 710.0d0) then
tmp = log(((x + y) * z)) + ((log(t) * (a + (-0.5d0))) - t)
else
tmp = (log(t) * a) - 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((x + y)) + Math.log(z)) <= 710.0) {
tmp = Math.log(((x + y) * z)) + ((Math.log(t) * (a + -0.5)) - t);
} else {
tmp = (Math.log(t) * a) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (math.log((x + y)) + math.log(z)) <= 710.0: tmp = math.log(((x + y) * z)) + ((math.log(t) * (a + -0.5)) - t) else: tmp = (math.log(t) * a) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(log(Float64(x + y)) + log(z)) <= 710.0) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(Float64(log(t) * Float64(a + -0.5)) - t)); else tmp = Float64(Float64(log(t) * a) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((log((x + y)) + log(z)) <= 710.0) tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t); else tmp = (log(t) * a) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], 710.0], N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log \left(x + y\right) + \log z \leq 710:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \left(\log t \cdot \left(a + -0.5\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\log t \cdot a - t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 710Initial program 99.6%
associate-+l-99.6%
+-commutative99.6%
sum-log98.6%
sub-neg98.6%
metadata-eval98.6%
*-commutative98.6%
Applied egg-rr98.6%
if 710 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around 0 99.7%
Taylor expanded in a around inf 82.8%
*-commutative82.8%
Simplified82.8%
Final simplification94.9%
(FPCore (x y z t a) :precision binary64 (if (<= (+ (log (+ x y)) (log z)) 710.0) (- (+ (* (log t) (- a 0.5)) (log (* y z))) t) (- (* (log t) a) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((log((x + y)) + log(z)) <= 710.0) {
tmp = ((log(t) * (a - 0.5)) + log((y * z))) - t;
} else {
tmp = (log(t) * a) - 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((x + y)) + log(z)) <= 710.0d0) then
tmp = ((log(t) * (a - 0.5d0)) + log((y * z))) - t
else
tmp = (log(t) * a) - 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((x + y)) + Math.log(z)) <= 710.0) {
tmp = ((Math.log(t) * (a - 0.5)) + Math.log((y * z))) - t;
} else {
tmp = (Math.log(t) * a) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (math.log((x + y)) + math.log(z)) <= 710.0: tmp = ((math.log(t) * (a - 0.5)) + math.log((y * z))) - t else: tmp = (math.log(t) * a) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(log(Float64(x + y)) + log(z)) <= 710.0) tmp = Float64(Float64(Float64(log(t) * Float64(a - 0.5)) + log(Float64(y * z))) - t); else tmp = Float64(Float64(log(t) * a) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((log((x + y)) + log(z)) <= 710.0) tmp = ((log(t) * (a - 0.5)) + log((y * z))) - t; else tmp = (log(t) * a) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], 710.0], N[(N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log \left(x + y\right) + \log z \leq 710:\\
\;\;\;\;\left(\log t \cdot \left(a - 0.5\right) + \log \left(y \cdot z\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log t \cdot a - t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 710Initial program 99.6%
add-cbrt-cube40.4%
pow340.4%
+-commutative40.4%
sub-neg40.4%
metadata-eval40.4%
*-commutative40.4%
fma-define40.4%
+-commutative40.4%
sum-log39.8%
Applied egg-rr39.8%
Taylor expanded in x around 0 62.6%
if 710 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around 0 99.7%
Taylor expanded in a around inf 82.8%
*-commutative82.8%
Simplified82.8%
Final simplification67.2%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.00023) (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) (- (* (log t) a) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.00023) {
tmp = log(y) + (log(z) + (log(t) * (a - 0.5)));
} else {
tmp = (log(t) * a) - 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.00023d0) then
tmp = log(y) + (log(z) + (log(t) * (a - 0.5d0)))
else
tmp = (log(t) * a) - 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.00023) {
tmp = Math.log(y) + (Math.log(z) + (Math.log(t) * (a - 0.5)));
} else {
tmp = (Math.log(t) * a) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.00023: tmp = math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5))) else: tmp = (math.log(t) * a) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.00023) tmp = Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))); else tmp = Float64(Float64(log(t) * a) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 0.00023) tmp = log(y) + (log(z) + (log(t) * (a - 0.5))); else tmp = (log(t) * a) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.00023], 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[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.00023:\\
\;\;\;\;\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log t \cdot a - t\\
\end{array}
\end{array}
if t < 2.3000000000000001e-4Initial program 99.3%
associate--l+99.3%
+-commutative99.3%
associate-+l+99.2%
+-commutative99.2%
fma-define99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around 0 62.6%
Taylor expanded in t around 0 62.6%
if 2.3000000000000001e-4 < t Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around 0 99.9%
Taylor expanded in a around inf 99.8%
*-commutative99.8%
Simplified99.8%
Final simplification81.5%
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (log t) (- a 0.5))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + (log(t) * (a - 0.5));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + (log(t) * (a - 0.5d0))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + (Math.log(t) * (a - 0.5));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + (math.log(t) * (a - 0.5))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(log(t) * Float64(a - 0.5))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + (log(t) * (a - 0.5)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \log t \cdot \left(a - 0.5\right)
\end{array}
Initial program 99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (- (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) t))
double code(double x, double y, double z, double t, double a) {
return (log(y) + (log(z) + (log(t) * (a - 0.5)))) - t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (log(y) + (log(z) + (log(t) * (a - 0.5d0)))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(y) + (Math.log(z) + (Math.log(t) * (a - 0.5)))) - t;
}
def code(x, y, z, t, a): return (math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5)))) - t
function code(x, y, z, t, a) return Float64(Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(y) + (log(z) + (log(t) * (a - 0.5)))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 69.8%
Final simplification69.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.00032) (not (<= a 0.46))) (- (* (log t) a) 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 <= -0.00032) || !(a <= 0.46)) {
tmp = (log(t) * a) - 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 <= (-0.00032d0)) .or. (.not. (a <= 0.46d0))) then
tmp = (log(t) * a) - 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 <= -0.00032) || !(a <= 0.46)) {
tmp = (Math.log(t) * a) - 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 <= -0.00032) or not (a <= 0.46): tmp = (math.log(t) * a) - 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 <= -0.00032) || !(a <= 0.46)) tmp = Float64(Float64(log(t) * a) - 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 <= -0.00032) || ~((a <= 0.46))) tmp = (log(t) * a) - 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, -0.00032], N[Not[LessEqual[a, 0.46]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * a), $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 -0.00032 \lor \neg \left(a \leq 0.46\right):\\
\;\;\;\;\log t \cdot a - 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 < -3.20000000000000026e-4 or 0.46000000000000002 < a Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around 0 99.7%
Taylor expanded in a around inf 98.5%
*-commutative98.5%
Simplified98.5%
if -3.20000000000000026e-4 < a < 0.46000000000000002Initial program 99.4%
associate--l+99.4%
+-commutative99.4%
associate-+l+99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 66.1%
*-un-lft-identity66.1%
associate-+r+66.1%
add-log-exp51.3%
exp-sum43.1%
sum-log43.2%
add-exp-log43.3%
exp-to-pow43.3%
sub-neg43.3%
metadata-eval43.3%
Applied egg-rr43.3%
*-lft-identity43.3%
associate-*l*48.0%
Simplified48.0%
Final simplification76.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8.8e-16) (not (<= a 0.00047))) (- (* (log t) a) t) (+ (log (* y z)) (- (* (log t) -0.5) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8.8e-16) || !(a <= 0.00047)) {
tmp = (log(t) * a) - t;
} else {
tmp = log((y * z)) + ((log(t) * -0.5) - t);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-8.8d-16)) .or. (.not. (a <= 0.00047d0))) then
tmp = (log(t) * a) - t
else
tmp = log((y * z)) + ((log(t) * (-0.5d0)) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8.8e-16) || !(a <= 0.00047)) {
tmp = (Math.log(t) * a) - t;
} else {
tmp = Math.log((y * z)) + ((Math.log(t) * -0.5) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -8.8e-16) or not (a <= 0.00047): tmp = (math.log(t) * a) - t else: tmp = math.log((y * z)) + ((math.log(t) * -0.5) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8.8e-16) || !(a <= 0.00047)) tmp = Float64(Float64(log(t) * a) - t); else tmp = Float64(log(Float64(y * z)) + Float64(Float64(log(t) * -0.5) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -8.8e-16) || ~((a <= 0.00047))) tmp = (log(t) * a) - t; else tmp = log((y * z)) + ((log(t) * -0.5) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8.8e-16], N[Not[LessEqual[a, 0.00047]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.8 \cdot 10^{-16} \lor \neg \left(a \leq 0.00047\right):\\
\;\;\;\;\log t \cdot a - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot z\right) + \left(\log t \cdot -0.5 - t\right)\\
\end{array}
\end{array}
if a < -8.80000000000000001e-16 or 4.69999999999999986e-4 < a Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around 0 99.7%
Taylor expanded in a around inf 96.7%
*-commutative96.7%
Simplified96.7%
if -8.80000000000000001e-16 < a < 4.69999999999999986e-4Initial program 99.4%
add-cbrt-cube68.1%
pow368.2%
+-commutative68.2%
sub-neg68.2%
metadata-eval68.2%
*-commutative68.2%
fma-define68.1%
+-commutative68.1%
sum-log52.8%
Applied egg-rr52.8%
Taylor expanded in a around 0 72.3%
Taylor expanded in x around 0 44.9%
associate--l+44.9%
*-commutative44.9%
*-commutative44.9%
Simplified44.9%
Final simplification75.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.23) (not (<= a 1.7))) (- (* (log t) a) t) (+ (log (+ x y)) (- (log z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.23) || !(a <= 1.7)) {
tmp = (log(t) * a) - t;
} else {
tmp = log((x + y)) + (log(z) - 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.23d0)) .or. (.not. (a <= 1.7d0))) then
tmp = (log(t) * a) - t
else
tmp = log((x + y)) + (log(z) - 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.23) || !(a <= 1.7)) {
tmp = (Math.log(t) * a) - t;
} else {
tmp = Math.log((x + y)) + (Math.log(z) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -0.23) or not (a <= 1.7): tmp = (math.log(t) * a) - t else: tmp = math.log((x + y)) + (math.log(z) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.23) || !(a <= 1.7)) tmp = Float64(Float64(log(t) * a) - t); else tmp = Float64(log(Float64(x + y)) + Float64(log(z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -0.23) || ~((a <= 1.7))) tmp = (log(t) * a) - t; else tmp = log((x + y)) + (log(z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.23], N[Not[LessEqual[a, 1.7]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.23 \lor \neg \left(a \leq 1.7\right):\\
\;\;\;\;\log t \cdot a - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z - t\right)\\
\end{array}
\end{array}
if a < -0.23000000000000001 or 1.69999999999999996 < a Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around 0 99.7%
Taylor expanded in a around inf 98.5%
*-commutative98.5%
Simplified98.5%
if -0.23000000000000001 < a < 1.69999999999999996Initial program 99.4%
associate-+l-99.4%
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%
Taylor expanded in t around inf 55.6%
Final simplification79.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (log t) a))) (if (<= t 0.00023) (+ (log (+ x y)) t_1) (- t_1 t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * a;
double tmp;
if (t <= 0.00023) {
tmp = log((x + y)) + t_1;
} else {
tmp = t_1 - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = log(t) * a
if (t <= 0.00023d0) then
tmp = log((x + y)) + t_1
else
tmp = t_1 - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = Math.log(t) * a;
double tmp;
if (t <= 0.00023) {
tmp = Math.log((x + y)) + t_1;
} else {
tmp = t_1 - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(t) * a tmp = 0 if t <= 0.00023: tmp = math.log((x + y)) + t_1 else: tmp = t_1 - t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(t) * a) tmp = 0.0 if (t <= 0.00023) tmp = Float64(log(Float64(x + y)) + t_1); else tmp = Float64(t_1 - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(t) * a; tmp = 0.0; if (t <= 0.00023) tmp = log((x + y)) + t_1; else tmp = t_1 - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[t, 0.00023], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$1 - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot a\\
\mathbf{if}\;t \leq 0.00023:\\
\;\;\;\;\log \left(x + y\right) + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t\\
\end{array}
\end{array}
if t < 2.3000000000000001e-4Initial program 99.3%
associate-+l-99.3%
associate--l+99.3%
sub-neg99.3%
+-commutative99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
fma-undefine99.3%
sub-neg99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in a around inf 57.8%
*-commutative57.8%
Simplified57.8%
if 2.3000000000000001e-4 < t Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around 0 99.9%
Taylor expanded in a around inf 99.8%
*-commutative99.8%
Simplified99.8%
Final simplification79.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (log t) a))) (if (<= t 0.00023) (+ (log y) t_1) (- t_1 t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * a;
double tmp;
if (t <= 0.00023) {
tmp = log(y) + t_1;
} else {
tmp = t_1 - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = log(t) * a
if (t <= 0.00023d0) then
tmp = log(y) + t_1
else
tmp = t_1 - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = Math.log(t) * a;
double tmp;
if (t <= 0.00023) {
tmp = Math.log(y) + t_1;
} else {
tmp = t_1 - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(t) * a tmp = 0 if t <= 0.00023: tmp = math.log(y) + t_1 else: tmp = t_1 - t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(t) * a) tmp = 0.0 if (t <= 0.00023) tmp = Float64(log(y) + t_1); else tmp = Float64(t_1 - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(t) * a; tmp = 0.0; if (t <= 0.00023) tmp = log(y) + t_1; else tmp = t_1 - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[t, 0.00023], N[(N[Log[y], $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$1 - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot a\\
\mathbf{if}\;t \leq 0.00023:\\
\;\;\;\;\log y + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t\\
\end{array}
\end{array}
if t < 2.3000000000000001e-4Initial program 99.3%
associate-+l-99.3%
associate--l+99.3%
sub-neg99.3%
+-commutative99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
fma-undefine99.3%
sub-neg99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in t around inf 74.2%
mul-1-neg74.2%
unsub-neg74.2%
*-commutative74.2%
log-rec74.2%
Simplified74.2%
Taylor expanded in a around inf 33.4%
*-commutative33.4%
*-lft-identity33.4%
times-frac33.4%
/-rgt-identity33.4%
Simplified33.4%
Taylor expanded in x around 0 43.4%
+-commutative43.4%
*-commutative43.4%
Simplified43.4%
if 2.3000000000000001e-4 < t Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around 0 99.9%
Taylor expanded in a around inf 99.8%
*-commutative99.8%
Simplified99.8%
Final simplification72.0%
(FPCore (x y z t a) :precision binary64 (if (<= t 580.0) (log (+ x y)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 580.0) {
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 <= 580.0d0) 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 <= 580.0) {
tmp = Math.log((x + y));
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 580.0: tmp = math.log((x + y)) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 580.0) 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 <= 580.0) tmp = log((x + y)); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 580.0], N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 580:\\
\;\;\;\;\log \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 580Initial program 99.3%
associate-+l-99.3%
associate--l+99.3%
sub-neg99.3%
+-commutative99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
fma-undefine99.3%
sub-neg99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in t around inf 9.3%
neg-mul-19.3%
Simplified9.3%
Taylor expanded in t around 0 9.3%
if 580 < t Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around 0 99.9%
Taylor expanded in t around inf 75.4%
neg-mul-175.4%
Simplified75.4%
Final simplification42.1%
(FPCore (x y z t a) :precision binary64 (- (* (log t) a) t))
double code(double x, double y, double z, double t, double a) {
return (log(t) * a) - 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) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(t) * a) - t;
}
def code(x, y, z, t, a): return (math.log(t) * a) - t
function code(x, y, z, t, a) return Float64(Float64(log(t) * a) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(t) * a) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log t \cdot a - t
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in a around 0 99.6%
Taylor expanded in a around inf 76.1%
*-commutative76.1%
Simplified76.1%
Final simplification76.1%
(FPCore (x y z t a) :precision binary64 (- (log y) t))
double code(double x, double y, double z, double t, double a) {
return 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(y) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return Math.log(y) - t;
}
def code(x, y, z, t, a): return math.log(y) - t
function code(x, y, z, t, a) return Float64(log(y) - t) end
function tmp = code(x, y, z, t, a) tmp = log(y) - t; end
code[x_, y_, z_, t_, a_] := N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log y - 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 42.1%
neg-mul-142.1%
Simplified42.1%
Taylor expanded in x around 0 33.2%
Final simplification33.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 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%
+-commutative99.6%
associate-+l+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in a around 0 99.6%
Taylor expanded in t around inf 38.7%
neg-mul-138.7%
Simplified38.7%
Final simplification38.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 2024095
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:alt
(+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))