
(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 12 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)) 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}
Initial program 99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.16) (+ (* (- a 0.5) (log t)) (+ (log z) (log y))) (fma (log t) a (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.16) {
tmp = ((a - 0.5) * log(t)) + (log(z) + log(y));
} else {
tmp = fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.16) tmp = Float64(Float64(Float64(a - 0.5) * log(t)) + Float64(log(z) + log(y))); else tmp = fma(log(t), a, Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.16], N[(N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.16:\\
\;\;\;\;\left(a - 0.5\right) \cdot \log t + \left(\log z + \log y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if t < 0.160000000000000003Initial program 99.3%
associate--l+99.3%
+-commutative99.3%
associate-+l+99.2%
+-commutative99.2%
fma-def99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around 0 58.9%
Taylor expanded in t around 0 58.9%
if 0.160000000000000003 < t Initial program 99.8%
associate--l+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 73.0%
Taylor expanded in a around inf 99.2%
*-commutative27.1%
Simplified99.2%
Taylor expanded in t around 0 99.2%
neg-mul-199.2%
+-commutative99.2%
*-commutative99.2%
fma-udef99.2%
Simplified99.2%
Final simplification81.7%
(FPCore (x y z t a) :precision binary64 (+ (- (log z) t) (+ (* (- a 0.5) (log t)) (log y))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + (((a - 0.5) * log(t)) + log(y));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (log(z) - t) + (((a - 0.5d0) * log(t)) + log(y))
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(z) - t) + (((a - 0.5) * Math.log(t)) + Math.log(y));
}
def code(x, y, z, t, a): return (math.log(z) - t) + (((a - 0.5) * math.log(t)) + math.log(y))
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + Float64(Float64(Float64(a - 0.5) * log(t)) + log(y))) end
function tmp = code(x, y, z, t, a) tmp = (log(z) - t) + (((a - 0.5) * log(t)) + log(y)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \left(\left(a - 0.5\right) \cdot \log t + \log y\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.5%
+-commutative99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 66.9%
Final simplification66.9%
(FPCore (x y z t a) :precision binary64 (- (+ (* (- a 0.5) (log t)) (+ (log z) (log y))) t))
double code(double x, double y, double z, double t, double a) {
return (((a - 0.5) * log(t)) + (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 = (((a - 0.5d0) * log(t)) + (log(z) + log(y))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (((a - 0.5) * Math.log(t)) + (Math.log(z) + Math.log(y))) - t;
}
def code(x, y, z, t, a): return (((a - 0.5) * math.log(t)) + (math.log(z) + math.log(y))) - t
function code(x, y, z, t, a) return Float64(Float64(Float64(Float64(a - 0.5) * log(t)) + Float64(log(z) + log(y))) - t) end
function tmp = code(x, y, z, t, a) tmp = (((a - 0.5) * log(t)) + (log(z) + log(y))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(a - 0.5\right) \cdot \log t + \left(\log z + \log y\right)\right) - t
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.5%
+-commutative99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 66.9%
Final simplification66.9%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.16) (- (+ (* (log t) (+ a -0.5)) (log (* (+ x y) z))) t) (fma (log t) a (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.16) {
tmp = ((log(t) * (a + -0.5)) + log(((x + y) * z))) - t;
} else {
tmp = fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.16) tmp = Float64(Float64(Float64(log(t) * Float64(a + -0.5)) + log(Float64(Float64(x + y) * z))) - t); else tmp = fma(log(t), a, Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.16], N[(N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.16:\\
\;\;\;\;\left(\log t \cdot \left(a + -0.5\right) + \log \left(\left(x + y\right) \cdot z\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if t < 0.160000000000000003Initial program 99.3%
associate--l+99.3%
+-commutative99.3%
associate-+l+99.2%
+-commutative99.2%
fma-def99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
+-commutative99.2%
fma-udef99.2%
metadata-eval99.2%
sub-neg99.2%
associate-+r+99.3%
associate-+r-99.3%
associate-+r-99.3%
sub-neg99.3%
metadata-eval99.3%
sum-log75.0%
Applied egg-rr75.0%
if 0.160000000000000003 < t Initial program 99.8%
associate--l+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 73.0%
Taylor expanded in a around inf 99.2%
*-commutative27.1%
Simplified99.2%
Taylor expanded in t around 0 99.2%
neg-mul-199.2%
+-commutative99.2%
*-commutative99.2%
fma-udef99.2%
Simplified99.2%
Final simplification88.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.16) (- (+ (* (- a 0.5) (log t)) (log (* y z))) t) (fma (log t) a (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.16) {
tmp = (((a - 0.5) * log(t)) + log((y * z))) - t;
} else {
tmp = fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.16) tmp = Float64(Float64(Float64(Float64(a - 0.5) * log(t)) + log(Float64(y * z))) - t); else tmp = fma(log(t), a, Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.16], N[(N[(N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.16:\\
\;\;\;\;\left(\left(a - 0.5\right) \cdot \log t + \log \left(y \cdot z\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if t < 0.160000000000000003Initial program 99.3%
associate--l+99.3%
+-commutative99.3%
associate-+l+99.2%
+-commutative99.2%
fma-def99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around 0 58.9%
Taylor expanded in z around inf 58.9%
mul-1-neg58.9%
log-rec58.9%
remove-double-neg58.9%
log-prod48.2%
Simplified48.2%
if 0.160000000000000003 < t Initial program 99.8%
associate--l+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 73.0%
Taylor expanded in a around inf 99.2%
*-commutative27.1%
Simplified99.2%
Taylor expanded in t around 0 99.2%
neg-mul-199.2%
+-commutative99.2%
*-commutative99.2%
fma-udef99.2%
Simplified99.2%
Final simplification77.1%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.0125) (+ (* (- a 0.5) (log t)) (log (* y z))) (fma (log t) a (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.0125) {
tmp = ((a - 0.5) * log(t)) + log((y * z));
} else {
tmp = fma(log(t), a, -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.0125) tmp = Float64(Float64(Float64(a - 0.5) * log(t)) + log(Float64(y * z))); else tmp = fma(log(t), a, Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.0125], N[(N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.0125:\\
\;\;\;\;\left(a - 0.5\right) \cdot \log t + \log \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, -t\right)\\
\end{array}
\end{array}
if t < 0.012500000000000001Initial program 99.3%
associate--l+99.3%
+-commutative99.3%
associate-+l+99.2%
+-commutative99.2%
fma-def99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around 0 58.9%
Taylor expanded in t around 0 58.9%
Taylor expanded in z around inf 58.9%
mul-1-neg58.9%
log-rec58.9%
remove-double-neg58.9%
log-prod48.2%
Simplified48.2%
if 0.012500000000000001 < t Initial program 99.8%
associate--l+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 73.0%
Taylor expanded in a around inf 99.2%
*-commutative27.1%
Simplified99.2%
Taylor expanded in t around 0 99.2%
neg-mul-199.2%
+-commutative99.2%
*-commutative99.2%
fma-udef99.2%
Simplified99.2%
Final simplification77.1%
(FPCore (x y z t a) :precision binary64 (+ (- (log z) t) (* a (log t))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + (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 = (log(z) - t) + (a * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(z) - t) + (a * Math.log(t));
}
def code(x, y, z, t, a): return (math.log(z) - t) + (a * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + Float64(a * log(t))) end
function tmp = code(x, y, z, t, a) tmp = (log(z) - t) + (a * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + a \cdot \log t
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.5%
+-commutative99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in a around inf 77.4%
*-commutative77.4%
Simplified77.4%
Final simplification77.4%
(FPCore (x y z t a) :precision binary64 (fma (log t) a (- t)))
double code(double x, double y, double z, double t, double a) {
return fma(log(t), a, -t);
}
function code(x, y, z, t, a) return fma(log(t), a, Float64(-t)) end
code[x_, y_, z_, t_, a_] := N[(N[Log[t], $MachinePrecision] * a + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log t, a, -t\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.5%
+-commutative99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 66.9%
Taylor expanded in a around inf 74.6%
*-commutative33.8%
Simplified74.6%
Taylor expanded in t around 0 74.6%
neg-mul-174.6%
+-commutative74.6%
*-commutative74.6%
fma-udef74.6%
Simplified74.6%
Final simplification74.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.1e+100) (not (<= a 5e+53))) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.1e+100) || !(a <= 5e+53)) {
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 ((a <= (-2.1d+100)) .or. (.not. (a <= 5d+53))) 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 ((a <= -2.1e+100) || !(a <= 5e+53)) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.1e+100) or not (a <= 5e+53): tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.1e+100) || !(a <= 5e+53)) 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 ((a <= -2.1e+100) || ~((a <= 5e+53))) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.1e+100], N[Not[LessEqual[a, 5e+53]], $MachinePrecision]], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.1 \cdot 10^{+100} \lor \neg \left(a \leq 5 \cdot 10^{+53}\right):\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if a < -2.0999999999999999e100 or 5.0000000000000004e53 < a Initial program 99.5%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.5%
+-commutative99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 70.0%
Taylor expanded in t around 0 57.0%
Taylor expanded in a around inf 83.9%
*-commutative83.9%
Simplified83.9%
if -2.0999999999999999e100 < a < 5.0000000000000004e53Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.5%
+-commutative99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in t around inf 55.6%
neg-mul-155.6%
Simplified55.6%
Final simplification64.8%
(FPCore (x y z t a) :precision binary64 (- (* a (log t)) t))
double code(double x, double y, double z, double t, double a) {
return (a * log(t)) - t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (a * log(t)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (a * Math.log(t)) - t;
}
def code(x, y, z, t, a): return (a * math.log(t)) - t
function code(x, y, z, t, a) return Float64(Float64(a * log(t)) - t) end
function tmp = code(x, y, z, t, a) tmp = (a * log(t)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \log t - t
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.5%
+-commutative99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 66.9%
Taylor expanded in a around inf 74.6%
*-commutative33.8%
Simplified74.6%
Final simplification74.6%
(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.5%
+-commutative99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in t around inf 42.9%
neg-mul-142.9%
Simplified42.9%
Final simplification42.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 2023279
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))