
(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 (+ x y)) (log z)) t) (* (- a 0.5) (* 2.0 (log (sqrt t))))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * (2.0 * log(sqrt(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) * (2.0d0 * log(sqrt(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) * (2.0 * Math.log(Math.sqrt(t))));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * (2.0 * math.log(math.sqrt(t))))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * Float64(2.0 * log(sqrt(t))))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * (2.0 * log(sqrt(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[(2.0 * N[Log[N[Sqrt[t], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \left(2 \cdot \log \left(\sqrt{t}\right)\right)
\end{array}
Initial program 99.6%
add-sqr-sqrt99.6%
log-prod99.6%
Applied egg-rr99.6%
count-299.6%
Simplified99.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.1e-16) (+ (log (+ x y)) (+ (log z) (* (- a 0.5) (log t)))) (- (+ (+ (log z) (log y)) (* a (log t))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.1e-16) {
tmp = log((x + y)) + (log(z) + ((a - 0.5) * log(t)));
} else {
tmp = ((log(z) + 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 (t <= 1.1d-16) then
tmp = log((x + y)) + (log(z) + ((a - 0.5d0) * log(t)))
else
tmp = ((log(z) + 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 (t <= 1.1e-16) {
tmp = Math.log((x + y)) + (Math.log(z) + ((a - 0.5) * Math.log(t)));
} else {
tmp = ((Math.log(z) + Math.log(y)) + (a * Math.log(t))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.1e-16: tmp = math.log((x + y)) + (math.log(z) + ((a - 0.5) * math.log(t))) else: tmp = ((math.log(z) + math.log(y)) + (a * math.log(t))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.1e-16) tmp = Float64(log(Float64(x + y)) + Float64(log(z) + Float64(Float64(a - 0.5) * log(t)))); else tmp = Float64(Float64(Float64(log(z) + log(y)) + Float64(a * log(t))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.1e-16) tmp = log((x + y)) + (log(z) + ((a - 0.5) * log(t))); else tmp = ((log(z) + log(y)) + (a * log(t))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.1e-16], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.1 \cdot 10^{-16}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z + \left(a - 0.5\right) \cdot \log t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\log z + \log y\right) + a \cdot \log t\right) - t\\
\end{array}
\end{array}
if t < 1.1e-16Initial program 99.2%
associate-+l-99.2%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-undefine99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in t around 0 99.2%
if 1.1e-16 < 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 x around 0 76.1%
associate-+r+76.1%
sub-neg76.1%
metadata-eval76.1%
Simplified76.1%
Taylor expanded in a around inf 75.2%
Final simplification87.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log z) (log y))))
(if (<= t 1.1e-16)
(+ t_1 (* (- a 0.5) (log t)))
(- (+ t_1 (* a (log t))) t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(z) + log(y);
double tmp;
if (t <= 1.1e-16) {
tmp = t_1 + ((a - 0.5) * log(t));
} else {
tmp = (t_1 + (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) :: t_1
real(8) :: tmp
t_1 = log(z) + log(y)
if (t <= 1.1d-16) then
tmp = t_1 + ((a - 0.5d0) * log(t))
else
tmp = (t_1 + (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 t_1 = Math.log(z) + Math.log(y);
double tmp;
if (t <= 1.1e-16) {
tmp = t_1 + ((a - 0.5) * Math.log(t));
} else {
tmp = (t_1 + (a * Math.log(t))) - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(z) + math.log(y) tmp = 0 if t <= 1.1e-16: tmp = t_1 + ((a - 0.5) * math.log(t)) else: tmp = (t_1 + (a * math.log(t))) - t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(z) + log(y)) tmp = 0.0 if (t <= 1.1e-16) tmp = Float64(t_1 + Float64(Float64(a - 0.5) * log(t))); else tmp = Float64(Float64(t_1 + Float64(a * log(t))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(z) + log(y); tmp = 0.0; if (t <= 1.1e-16) tmp = t_1 + ((a - 0.5) * log(t)); else tmp = (t_1 + (a * log(t))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 1.1e-16], N[(t$95$1 + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log z + \log y\\
\mathbf{if}\;t \leq 1.1 \cdot 10^{-16}:\\
\;\;\;\;t\_1 + \left(a - 0.5\right) \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + a \cdot \log t\right) - t\\
\end{array}
\end{array}
if t < 1.1e-16Initial program 99.2%
associate-+l-99.2%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-undefine99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in t around 0 99.2%
Taylor expanded in x around 0 59.4%
*-commutative59.4%
Simplified59.4%
if 1.1e-16 < 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 x around 0 76.1%
associate-+r+76.1%
sub-neg76.1%
metadata-eval76.1%
Simplified76.1%
Taylor expanded in a around inf 75.2%
Final simplification67.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 470.0) (+ (+ (log z) (log y)) (* (- a 0.5) (log t))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 470.0) {
tmp = (log(z) + log(y)) + ((a - 0.5) * log(t));
} else {
tmp = (a * log(t)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 470.0d0) then
tmp = (log(z) + log(y)) + ((a - 0.5d0) * log(t))
else
tmp = (a * log(t)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 470.0) {
tmp = (Math.log(z) + Math.log(y)) + ((a - 0.5) * Math.log(t));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 470.0: tmp = (math.log(z) + math.log(y)) + ((a - 0.5) * math.log(t)) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 470.0) tmp = Float64(Float64(log(z) + log(y)) + Float64(Float64(a - 0.5) * log(t))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 470.0) tmp = (log(z) + log(y)) + ((a - 0.5) * log(t)); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 470.0], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 470:\\
\;\;\;\;\left(\log z + \log y\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 470Initial program 99.2%
associate-+l-99.2%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-undefine99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in t around 0 98.7%
Taylor expanded in x around 0 59.7%
*-commutative59.7%
Simplified59.7%
if 470 < 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 x around 0 76.0%
associate-+r+76.0%
sub-neg76.0%
metadata-eval76.0%
Simplified76.0%
Taylor expanded in a around inf 76.0%
Taylor expanded in a around inf 98.6%
Final simplification78.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 480.0) (+ (log y) (+ (log z) (* (- a 0.5) (log t)))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 480.0) {
tmp = log(y) + (log(z) + ((a - 0.5) * log(t)));
} else {
tmp = (a * log(t)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 480.0d0) then
tmp = log(y) + (log(z) + ((a - 0.5d0) * log(t)))
else
tmp = (a * log(t)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 480.0) {
tmp = Math.log(y) + (Math.log(z) + ((a - 0.5) * Math.log(t)));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 480.0: tmp = math.log(y) + (math.log(z) + ((a - 0.5) * math.log(t))) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 480.0) tmp = Float64(log(y) + Float64(log(z) + Float64(Float64(a - 0.5) * log(t)))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 480.0) tmp = log(y) + (log(z) + ((a - 0.5) * log(t))); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 480.0], N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 480:\\
\;\;\;\;\log y + \left(\log z + \left(a - 0.5\right) \cdot \log t\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 480Initial program 99.2%
associate-+l-99.2%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-undefine99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in t around 0 98.7%
Taylor expanded in x around 0 59.7%
associate--l+59.7%
*-commutative59.7%
Simplified59.7%
if 480 < 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 x around 0 76.0%
associate-+r+76.0%
sub-neg76.0%
metadata-eval76.0%
Simplified76.0%
Taylor expanded in a around inf 76.0%
Taylor expanded in a around inf 98.6%
Final simplification78.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(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%
(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(Float64(log(z) + log(y)) + 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[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log z + \log y\right) + \log t \cdot \left(a + -0.5\right)\right) - t
\end{array}
Initial program 99.6%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 67.9%
associate-+r+67.9%
sub-neg67.9%
metadata-eval67.9%
Simplified67.9%
Final simplification67.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.17) (not (<= a 1.85))) (- (* a (log t)) t) (+ (log (+ x y)) (- (log z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.17) || !(a <= 1.85)) {
tmp = (a * log(t)) - 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.17d0)) .or. (.not. (a <= 1.85d0))) then
tmp = (a * log(t)) - 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.17) || !(a <= 1.85)) {
tmp = (a * Math.log(t)) - 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.17) or not (a <= 1.85): tmp = (a * math.log(t)) - 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.17) || !(a <= 1.85)) tmp = Float64(Float64(a * log(t)) - 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.17) || ~((a <= 1.85))) tmp = (a * log(t)) - 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.17], N[Not[LessEqual[a, 1.85]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $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.17 \lor \neg \left(a \leq 1.85\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z - t\right)\\
\end{array}
\end{array}
if a < -0.170000000000000012 or 1.8500000000000001 < a Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 79.1%
associate-+r+79.1%
sub-neg79.1%
metadata-eval79.1%
Simplified79.1%
Taylor expanded in a around inf 79.1%
Taylor expanded in a around inf 98.2%
if -0.170000000000000012 < a < 1.8500000000000001Initial program 99.5%
associate-+l-99.5%
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 t around inf 55.8%
Final simplification75.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 5e-17) (+ (log (* (+ x y) z)) (* (- a 0.5) (log t))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5e-17) {
tmp = log(((x + y) * z)) + ((a - 0.5) * log(t));
} else {
tmp = (a * log(t)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 5d-17) then
tmp = log(((x + y) * z)) + ((a - 0.5d0) * log(t))
else
tmp = (a * log(t)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5e-17) {
tmp = Math.log(((x + y) * z)) + ((a - 0.5) * Math.log(t));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 5e-17: tmp = math.log(((x + y) * z)) + ((a - 0.5) * math.log(t)) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 5e-17) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(Float64(a - 0.5) * log(t))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 5e-17) tmp = log(((x + y) * z)) + ((a - 0.5) * log(t)); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 5e-17], N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 4.9999999999999999e-17Initial program 99.2%
associate-+l-99.2%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-undefine99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in t around 0 99.2%
associate-+r-99.2%
sum-log74.3%
Applied egg-rr74.3%
if 4.9999999999999999e-17 < 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 x around 0 76.1%
associate-+r+76.1%
sub-neg76.1%
metadata-eval76.1%
Simplified76.1%
Taylor expanded in a around inf 76.1%
Taylor expanded in a around inf 97.9%
Final simplification86.3%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.06e-16) (+ (log (* y z)) (* (- a 0.5) (log t))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.06e-16) {
tmp = log((y * z)) + ((a - 0.5) * log(t));
} else {
tmp = (a * log(t)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 1.06d-16) then
tmp = log((y * z)) + ((a - 0.5d0) * log(t))
else
tmp = (a * log(t)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.06e-16) {
tmp = Math.log((y * z)) + ((a - 0.5) * Math.log(t));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.06e-16: tmp = math.log((y * z)) + ((a - 0.5) * math.log(t)) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.06e-16) tmp = Float64(log(Float64(y * z)) + Float64(Float64(a - 0.5) * log(t))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.06e-16) tmp = log((y * z)) + ((a - 0.5) * log(t)); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.06e-16], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.06 \cdot 10^{-16}:\\
\;\;\;\;\log \left(y \cdot z\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 1.06e-16Initial program 99.2%
associate-+l-99.2%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-undefine99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in t around 0 99.2%
associate-+r-99.2%
sum-log74.3%
Applied egg-rr74.3%
Taylor expanded in x around 0 43.8%
if 1.06e-16 < 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 x around 0 76.1%
associate-+r+76.1%
sub-neg76.1%
metadata-eval76.1%
Simplified76.1%
Taylor expanded in a around inf 76.1%
Taylor expanded in a around inf 97.9%
Final simplification71.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.5e+22) (not (<= a 1.06e+80))) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.5e+22) || !(a <= 1.06e+80)) {
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 <= (-5.5d+22)) .or. (.not. (a <= 1.06d+80))) 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 <= -5.5e+22) || !(a <= 1.06e+80)) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5.5e+22) or not (a <= 1.06e+80): tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.5e+22) || !(a <= 1.06e+80)) 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 <= -5.5e+22) || ~((a <= 1.06e+80))) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.5e+22], N[Not[LessEqual[a, 1.06e+80]], $MachinePrecision]], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.5 \cdot 10^{+22} \lor \neg \left(a \leq 1.06 \cdot 10^{+80}\right):\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if a < -5.50000000000000021e22 or 1.05999999999999996e80 < a 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 83.1%
*-commutative83.1%
Simplified83.1%
if -5.50000000000000021e22 < a < 1.05999999999999996e80Initial 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 t around inf 49.4%
neg-mul-149.4%
Simplified49.4%
Final simplification63.0%
(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.5%
+-commutative99.5%
associate-+l+99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 67.9%
associate-+r+67.9%
sub-neg67.9%
metadata-eval67.9%
Simplified67.9%
Taylor expanded in a around inf 67.9%
Taylor expanded in a around inf 71.9%
(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.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 36.5%
neg-mul-136.5%
Simplified36.5%
(FPCore (x y z t a) :precision binary64 0.0)
double code(double x, double y, double z, double t, double a) {
return 0.0;
}
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 = 0.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
return 0.0;
}
def code(x, y, z, t, a): return 0.0
function code(x, y, z, t, a) return 0.0 end
function tmp = code(x, y, z, t, a) tmp = 0.0; end
code[x_, y_, z_, t_, a_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial 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 36.5%
neg-mul-136.5%
Simplified36.5%
expm1-log1p-u1.5%
expm1-undefine1.4%
Applied egg-rr1.4%
sub-neg1.4%
log1p-undefine1.4%
rem-exp-log36.4%
unsub-neg36.4%
metadata-eval36.4%
Simplified36.4%
Taylor expanded in t around 0 2.4%
metadata-eval2.4%
Applied egg-rr2.4%
(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 2024170
(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))))