
(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) (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 (<= (log z) 282.0) (+ (log (* (+ x y) z)) (- (* (log t) (+ a -0.5)) t)) (+ (log z) (+ (log (+ x y)) (* (log t) (- a 0.5))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (log(z) <= 282.0) {
tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t);
} else {
tmp = log(z) + (log((x + y)) + (log(t) * (a - 0.5)));
}
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) <= 282.0d0) then
tmp = log(((x + y) * z)) + ((log(t) * (a + (-0.5d0))) - t)
else
tmp = log(z) + (log((x + y)) + (log(t) * (a - 0.5d0)))
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) <= 282.0) {
tmp = Math.log(((x + y) * z)) + ((Math.log(t) * (a + -0.5)) - t);
} else {
tmp = Math.log(z) + (Math.log((x + y)) + (Math.log(t) * (a - 0.5)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.log(z) <= 282.0: tmp = math.log(((x + y) * z)) + ((math.log(t) * (a + -0.5)) - t) else: tmp = math.log(z) + (math.log((x + y)) + (math.log(t) * (a - 0.5))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (log(z) <= 282.0) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(Float64(log(t) * Float64(a + -0.5)) - t)); else tmp = Float64(log(z) + Float64(log(Float64(x + y)) + Float64(log(t) * Float64(a - 0.5)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (log(z) <= 282.0) tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t); else tmp = log(z) + (log((x + y)) + (log(t) * (a - 0.5))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Log[z], $MachinePrecision], 282.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[Log[z], $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log z \leq 282:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \left(\log t \cdot \left(a + -0.5\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\log z + \left(\log \left(x + y\right) + \log t \cdot \left(a - 0.5\right)\right)\\
\end{array}
\end{array}
if (log.f64 z) < 282Initial 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%
+-commutative99.6%
fma-undefine99.6%
metadata-eval99.6%
sub-neg99.6%
associate-+r+99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l-99.6%
sum-log90.2%
sub-neg90.2%
metadata-eval90.2%
*-commutative90.2%
Applied egg-rr90.2%
if 282 < (log.f64 z) Initial program 99.8%
associate-+l-99.8%
associate--l+99.7%
sub-neg99.7%
+-commutative99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-undefine99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
metadata-eval99.7%
metadata-eval99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in t around 0 64.7%
associate--l+64.6%
+-commutative64.6%
Simplified64.6%
Final simplification82.9%
(FPCore (x y z t a) :precision binary64 (if (<= (log z) 225.0) (+ (log (* (+ x y) z)) (- (* (log t) (+ a -0.5)) t)) (- (+ (log z) (log y)) (- t (* a (log t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (log(z) <= 225.0) {
tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t);
} else {
tmp = (log(z) + log(y)) - (t - (a * log(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) <= 225.0d0) then
tmp = log(((x + y) * z)) + ((log(t) * (a + (-0.5d0))) - t)
else
tmp = (log(z) + log(y)) - (t - (a * log(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) <= 225.0) {
tmp = Math.log(((x + y) * z)) + ((Math.log(t) * (a + -0.5)) - t);
} else {
tmp = (Math.log(z) + Math.log(y)) - (t - (a * Math.log(t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.log(z) <= 225.0: tmp = math.log(((x + y) * z)) + ((math.log(t) * (a + -0.5)) - t) else: tmp = (math.log(z) + math.log(y)) - (t - (a * math.log(t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (log(z) <= 225.0) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(Float64(log(t) * Float64(a + -0.5)) - t)); else tmp = Float64(Float64(log(z) + log(y)) - Float64(t - Float64(a * log(t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (log(z) <= 225.0) tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t); else tmp = (log(z) + log(y)) - (t - (a * log(t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Log[z], $MachinePrecision], 225.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[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(t - N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log z \leq 225:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \left(\log t \cdot \left(a + -0.5\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log z + \log y\right) - \left(t - a \cdot \log t\right)\\
\end{array}
\end{array}
if (log.f64 z) < 225Initial program 99.6%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
+-commutative99.6%
fma-undefine99.6%
metadata-eval99.6%
sub-neg99.6%
associate-+r+99.5%
associate--l+99.6%
+-commutative99.6%
associate-+l-99.6%
sum-log90.9%
sub-neg90.9%
metadata-eval90.9%
*-commutative90.9%
Applied egg-rr90.9%
if 225 < (log.f64 z) Initial program 99.7%
associate-+l-99.7%
associate--l+99.7%
sub-neg99.7%
+-commutative99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-undefine99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
metadata-eval99.7%
metadata-eval99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in x around 0 73.1%
Taylor expanded in a around inf 60.6%
mul-1-neg60.6%
distribute-rgt-neg-in60.6%
Simplified60.6%
Final simplification81.3%
(FPCore (x y z t a) :precision binary64 (+ (+ (log z) (log y)) (- (* (log t) (- a 0.5)) t)))
double code(double x, double y, double z, double t, double a) {
return (log(z) + log(y)) + ((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(z) + log(y)) + ((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(z) + Math.log(y)) + ((Math.log(t) * (a - 0.5)) - t);
}
def code(x, y, z, t, a): return (math.log(z) + math.log(y)) + ((math.log(t) * (a - 0.5)) - t)
function code(x, y, z, t, a) return Float64(Float64(log(z) + log(y)) + Float64(Float64(log(t) * Float64(a - 0.5)) - t)) end
function tmp = code(x, y, z, t, a) tmp = (log(z) + log(y)) + ((log(t) * (a - 0.5)) - t); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z + \log y\right) + \left(\log t \cdot \left(a - 0.5\right) - t\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%
Taylor expanded in x around 0 71.6%
Final simplification71.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -4e+96) (* a (log t)) (+ (log (* y z)) (- (* (log t) (+ a -0.5)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4e+96) {
tmp = a * log(t);
} else {
tmp = log((y * z)) + ((log(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 <= (-4d+96)) then
tmp = a * log(t)
else
tmp = log((y * z)) + ((log(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 <= -4e+96) {
tmp = a * Math.log(t);
} else {
tmp = Math.log((y * z)) + ((Math.log(t) * (a + -0.5)) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4e+96: tmp = a * math.log(t) else: tmp = math.log((y * z)) + ((math.log(t) * (a + -0.5)) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4e+96) tmp = Float64(a * log(t)); else tmp = Float64(log(Float64(y * z)) + Float64(Float64(log(t) * Float64(a + -0.5)) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -4e+96) tmp = a * log(t); else tmp = log((y * z)) + ((log(t) * (a + -0.5)) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4e+96], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4 \cdot 10^{+96}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot z\right) + \left(\log t \cdot \left(a + -0.5\right) - t\right)\\
\end{array}
\end{array}
if a < -4.0000000000000002e96Initial 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%
Taylor expanded in a around inf 87.6%
*-commutative87.6%
Simplified87.6%
if -4.0000000000000002e96 < a 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%
add-cube-cbrt98.1%
pow398.0%
Applied egg-rr76.9%
Taylor expanded in x around 0 55.4%
associate--l+55.4%
*-commutative55.4%
sub-neg55.4%
metadata-eval55.4%
Simplified55.4%
Final simplification61.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.02e+43) (+ (log (* y z)) (* (log t) (- a 0.5))) (- (log (* (* y z) (pow t (+ a -0.5)))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.02e+43) {
tmp = log((y * z)) + (log(t) * (a - 0.5));
} 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 (t <= 1.02d+43) then
tmp = log((y * z)) + (log(t) * (a - 0.5d0))
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 (t <= 1.02e+43) {
tmp = Math.log((y * z)) + (Math.log(t) * (a - 0.5));
} 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 t <= 1.02e+43: tmp = math.log((y * z)) + (math.log(t) * (a - 0.5)) 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 (t <= 1.02e+43) tmp = Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5))); else tmp = Float64(log(Float64(Float64(y * z) * (t ^ Float64(a + -0.5)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.02e+43) tmp = log((y * z)) + (log(t) * (a - 0.5)); else tmp = log(((y * z) * (t ^ (a + -0.5)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.02e+43], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(N[(y * z), $MachinePrecision] * N[Power[t, N[(a + -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.02 \cdot 10^{+43}:\\
\;\;\;\;\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(\left(y \cdot z\right) \cdot {t}^{\left(a + -0.5\right)}\right) - t\\
\end{array}
\end{array}
if t < 1.02e43Initial program 99.4%
associate-+l-99.4%
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 x around 0 69.8%
Taylor expanded in t around 0 67.6%
+-commutative67.6%
*-commutative67.6%
Simplified67.6%
sum-log55.4%
Applied egg-rr55.4%
if 1.02e43 < 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%
add-cube-cbrt98.1%
pow398.1%
Applied egg-rr72.0%
Taylor expanded in x around 0 52.6%
associate--l+52.6%
*-commutative52.6%
sub-neg52.6%
metadata-eval52.6%
Simplified52.6%
sum-log73.7%
associate-+r-73.7%
sum-log52.6%
add-log-exp28.8%
sum-log28.4%
exp-to-pow28.4%
Applied egg-rr28.4%
Final simplification42.9%
(FPCore (x y z t a) :precision binary64 (+ (log (* (+ x y) z)) (- (* (log t) (+ a -0.5)) t)))
double code(double x, double y, double z, double t, double a) {
return log(((x + y) * 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(((x + y) * 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(((x + y) * z)) + ((Math.log(t) * (a + -0.5)) - t);
}
def code(x, y, z, t, a): return math.log(((x + y) * z)) + ((math.log(t) * (a + -0.5)) - t)
function code(x, y, z, t, a) return Float64(log(Float64(Float64(x + y) * z)) + Float64(Float64(log(t) * Float64(a + -0.5)) - t)) end
function tmp = code(x, y, z, t, a) tmp = log(((x + y) * z)) + ((log(t) * (a + -0.5)) - t); end
code[x_, y_, z_, t_, a_] := 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]
\begin{array}{l}
\\
\log \left(\left(x + y\right) \cdot z\right) + \left(\log t \cdot \left(a + -0.5\right) - t\right)
\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%
+-commutative99.6%
fma-undefine99.6%
metadata-eval99.6%
sub-neg99.6%
associate-+r+99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l-99.6%
sum-log75.1%
sub-neg75.1%
metadata-eval75.1%
*-commutative75.1%
Applied egg-rr75.1%
Final simplification75.1%
(FPCore (x y z t a) :precision binary64 (+ (log (* y z)) (- (* (log t) -0.5) t)))
double code(double x, double y, double z, double t, double a) {
return log((y * z)) + ((log(t) * -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 * z)) + ((log(t) * (-0.5d0)) - t)
end function
public static double code(double x, double y, double z, double t, double a) {
return Math.log((y * z)) + ((Math.log(t) * -0.5) - t);
}
def code(x, y, z, t, a): return math.log((y * z)) + ((math.log(t) * -0.5) - t)
function code(x, y, z, t, a) return Float64(log(Float64(y * z)) + Float64(Float64(log(t) * -0.5) - t)) end
function tmp = code(x, y, z, t, a) tmp = log((y * z)) + ((log(t) * -0.5) - t); end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(y \cdot z\right) + \left(\log t \cdot -0.5 - t\right)
\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%
add-cube-cbrt98.1%
pow398.1%
Applied egg-rr73.9%
Taylor expanded in x around 0 55.3%
associate--l+55.3%
*-commutative55.3%
sub-neg55.3%
metadata-eval55.3%
Simplified55.3%
Taylor expanded in a around 0 32.9%
*-commutative32.9%
Simplified32.9%
Final simplification32.9%
(FPCore (x y z t a) :precision binary64 (if (<= a 1.15e+168) (- t) (fabs (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 1.15e+168) {
tmp = -t;
} else {
tmp = fabs((a * log(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 <= 1.15d+168) then
tmp = -t
else
tmp = abs((a * log(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 <= 1.15e+168) {
tmp = -t;
} else {
tmp = Math.abs((a * Math.log(t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= 1.15e+168: tmp = -t else: tmp = math.fabs((a * math.log(t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= 1.15e+168) tmp = Float64(-t); else tmp = abs(Float64(a * log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= 1.15e+168) tmp = -t; else tmp = abs((a * log(t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 1.15e+168], (-t), N[Abs[N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.15 \cdot 10^{+168}:\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;\left|a \cdot \log t\right|\\
\end{array}
\end{array}
if a < 1.15e168Initial program 99.6%
associate-+l-99.6%
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 41.5%
neg-mul-141.5%
Simplified41.5%
if 1.15e168 < a Initial program 99.7%
associate-+l-99.7%
associate--l+99.7%
sub-neg99.7%
+-commutative99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-undefine99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
metadata-eval99.7%
metadata-eval99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in a around inf 83.8%
*-commutative83.8%
Simplified83.8%
add-sqr-sqrt44.2%
sqrt-unprod3.7%
pow23.7%
Applied egg-rr3.7%
unpow23.7%
rem-sqrt-square44.7%
*-commutative44.7%
Simplified44.7%
Final simplification41.9%
(FPCore (x y z t a) :precision binary64 (if (<= a 1e+168) (- t) (fabs (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 1e+168) {
tmp = -t;
} else {
tmp = fabs((a * log(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 <= 1d+168) then
tmp = -t
else
tmp = abs((a * log(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 <= 1e+168) {
tmp = -t;
} else {
tmp = Math.abs((a * Math.log(t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= 1e+168: tmp = -t else: tmp = math.fabs((a * math.log(t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= 1e+168) tmp = Float64(-t); else tmp = abs(Float64(a * log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= 1e+168) tmp = -t; else tmp = abs((a * log(t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 1e+168], (-t), N[Abs[N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 10^{+168}:\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;\left|a \cdot \log t\right|\\
\end{array}
\end{array}
if a < 9.9999999999999993e167Initial program 99.6%
associate-+l-99.6%
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 41.5%
neg-mul-141.5%
Simplified41.5%
if 9.9999999999999993e167 < a Initial program 99.7%
associate-+l-99.7%
associate--l+99.7%
sub-neg99.7%
+-commutative99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-undefine99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
metadata-eval99.7%
metadata-eval99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in a around inf 83.8%
*-commutative83.8%
Simplified83.8%
add-log-exp6.0%
exp-to-pow6.0%
Applied egg-rr6.0%
pow-to-exp6.0%
add-log-exp83.8%
add-sqr-sqrt44.2%
pow1/244.2%
pow1/244.2%
pow-prod-down3.7%
pow23.7%
Applied egg-rr3.7%
unpow1/23.7%
unpow23.7%
rem-sqrt-square44.7%
Simplified44.7%
Final simplification41.9%
(FPCore (x y z t a) :precision binary64 (if (<= a -6.8e+17) (* a (log t)) (pow (- (cbrt t)) 3.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6.8e+17) {
tmp = a * log(t);
} else {
tmp = pow(-cbrt(t), 3.0);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6.8e+17) {
tmp = a * Math.log(t);
} else {
tmp = Math.pow(-Math.cbrt(t), 3.0);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -6.8e+17) tmp = Float64(a * log(t)); else tmp = Float64(-cbrt(t)) ^ 3.0; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -6.8e+17], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], N[Power[(-N[Power[t, 1/3], $MachinePrecision]), 3.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.8 \cdot 10^{+17}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;{\left(-\sqrt[3]{t}\right)}^{3}\\
\end{array}
\end{array}
if a < -6.8e17Initial 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.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in a around inf 85.2%
*-commutative85.2%
Simplified85.2%
if -6.8e17 < a 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%
add-cube-cbrt98.1%
pow398.1%
Applied egg-rr75.8%
Taylor expanded in t around -inf 44.2%
mul-1-neg44.2%
Simplified44.2%
Final simplification54.3%
(FPCore (x y z t a) :precision binary64 (- (+ (log z) (log y)) t))
double code(double x, double y, double z, double t, double a) {
return (log(z) + log(y)) - t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (log(z) + log(y)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(z) + Math.log(y)) - t;
}
def code(x, y, z, t, a): return (math.log(z) + math.log(y)) - t
function code(x, y, z, t, a) return Float64(Float64(log(z) + log(y)) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(z) + log(y)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z + \log y\right) - 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 x around 0 71.6%
Taylor expanded in t around inf 31.3%
Final simplification31.3%
(FPCore (x y z t a) :precision binary64 (* a (log t)))
double code(double x, double y, double z, double t, double a) {
return a * 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 = a * log(t)
end function
public static double code(double x, double y, double z, double t, double a) {
return a * Math.log(t);
}
def code(x, y, z, t, a): return a * math.log(t)
function code(x, y, z, t, a) return Float64(a * log(t)) end
function tmp = code(x, y, z, t, a) tmp = a * log(t); end
code[x_, y_, z_, t_, a_] := N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \log 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 a around inf 38.4%
*-commutative38.4%
Simplified38.4%
Final simplification38.4%
(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 37.9%
neg-mul-137.9%
Simplified37.9%
Final simplification37.9%
(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 2024066
(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))))