
(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 z) t) (fma (+ a -0.5) (log t) (log (+ x y)))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + fma((a + -0.5), log(t), log((x + y)));
}
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + fma(Float64(a + -0.5), log(t), log(Float64(x + y)))) end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \mathsf{fma}\left(a + -0.5, \log t, \log \left(x + y\right)\right)
\end{array}
Initial program 99.5%
+-commutative99.5%
associate--l+99.5%
associate-+r+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (log z) t)))
(if (or (<= (- a 0.5) -5e+20) (not (<= (- a 0.5) -0.49995)))
(+ t_1 (* a (log t)))
(+ t_1 (log (* y (pow t -0.5)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(z) - t;
double tmp;
if (((a - 0.5) <= -5e+20) || !((a - 0.5) <= -0.49995)) {
tmp = t_1 + (a * log(t));
} else {
tmp = t_1 + log((y * pow(t, -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) :: t_1
real(8) :: tmp
t_1 = log(z) - t
if (((a - 0.5d0) <= (-5d+20)) .or. (.not. ((a - 0.5d0) <= (-0.49995d0)))) then
tmp = t_1 + (a * log(t))
else
tmp = t_1 + log((y * (t ** (-0.5d0))))
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) - t;
double tmp;
if (((a - 0.5) <= -5e+20) || !((a - 0.5) <= -0.49995)) {
tmp = t_1 + (a * Math.log(t));
} else {
tmp = t_1 + Math.log((y * Math.pow(t, -0.5)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(z) - t tmp = 0 if ((a - 0.5) <= -5e+20) or not ((a - 0.5) <= -0.49995): tmp = t_1 + (a * math.log(t)) else: tmp = t_1 + math.log((y * math.pow(t, -0.5))) return tmp
function code(x, y, z, t, a) t_1 = Float64(log(z) - t) tmp = 0.0 if ((Float64(a - 0.5) <= -5e+20) || !(Float64(a - 0.5) <= -0.49995)) tmp = Float64(t_1 + Float64(a * log(t))); else tmp = Float64(t_1 + log(Float64(y * (t ^ -0.5)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(z) - t; tmp = 0.0; if (((a - 0.5) <= -5e+20) || ~(((a - 0.5) <= -0.49995))) tmp = t_1 + (a * log(t)); else tmp = t_1 + log((y * (t ^ -0.5))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]}, If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -5e+20], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], -0.49995]], $MachinePrecision]], N[(t$95$1 + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[Log[N[(y * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log z - t\\
\mathbf{if}\;a - 0.5 \leq -5 \cdot 10^{+20} \lor \neg \left(a - 0.5 \leq -0.49995\right):\\
\;\;\;\;t\_1 + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \log \left(y \cdot {t}^{-0.5}\right)\\
\end{array}
\end{array}
if (-.f64 a 1/2) < -5e20 or -0.49995000000000001 < (-.f64 a 1/2) Initial program 99.7%
+-commutative99.7%
associate--l+99.7%
associate-+r+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 72.3%
Taylor expanded in a around inf 99.5%
*-commutative99.5%
Simplified99.5%
if -5e20 < (-.f64 a 1/2) < -0.49995000000000001Initial program 99.4%
+-commutative99.4%
associate--l+99.4%
associate-+r+99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 62.9%
Taylor expanded in a around 0 62.9%
*-commutative62.9%
Simplified62.9%
add-log-exp62.9%
sum-log55.3%
pow-to-exp55.3%
Applied egg-rr55.3%
Final simplification77.9%
(FPCore (x y z t a) :precision binary64 (if (<= t 3.2e-8) (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) (+ (- (log z) t) (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 3.2e-8) {
tmp = log(y) + (log(z) + (log(t) * (a - 0.5)));
} else {
tmp = (log(z) - 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 (t <= 3.2d-8) then
tmp = log(y) + (log(z) + (log(t) * (a - 0.5d0)))
else
tmp = (log(z) - 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 (t <= 3.2e-8) {
tmp = Math.log(y) + (Math.log(z) + (Math.log(t) * (a - 0.5)));
} else {
tmp = (Math.log(z) - t) + (a * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 3.2e-8: tmp = math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5))) else: tmp = (math.log(z) - t) + (a * math.log(t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 3.2e-8) tmp = Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))); else tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 3.2e-8) tmp = log(y) + (log(z) + (log(t) * (a - 0.5))); else tmp = (log(z) - t) + (a * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 3.2e-8], 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[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.2 \cdot 10^{-8}:\\
\;\;\;\;\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\end{array}
\end{array}
if t < 3.2000000000000002e-8Initial program 99.2%
+-commutative99.2%
associate--l+99.2%
associate-+r+99.2%
+-commutative99.2%
fma-define99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around 0 62.2%
Taylor expanded in t around 0 62.2%
if 3.2000000000000002e-8 < t Initial program 99.9%
+-commutative99.9%
associate--l+99.9%
associate-+r+99.8%
+-commutative99.8%
fma-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 72.2%
Taylor expanded in a around inf 98.5%
*-commutative98.5%
Simplified98.5%
Final simplification82.2%
(FPCore (x y z t a) :precision binary64 (+ (+ (- (log z) t) (log (+ x y))) (* (+ a -0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log(z) - t) + log((x + y))) + ((a + -0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log(z) - t) + log((x + y))) + ((a + (-0.5d0)) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log(z) - t) + Math.log((x + y))) + ((a + -0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log(z) - t) + math.log((x + y))) + ((a + -0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(z) - t) + log(Float64(x + y))) + Float64(Float64(a + -0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log(z) - t) + log((x + y))) + ((a + -0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log z - t\right) + \log \left(x + y\right)\right) + \left(a + -0.5\right) \cdot \log t
\end{array}
Initial program 99.5%
remove-double-neg99.5%
associate--l+99.5%
remove-double-neg99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(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(a + -0.5) * log(t)) + Float64(log(z) + Float64(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[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(a + -0.5\right) \cdot \log t + \left(\log z + \left(\log y - t\right)\right)
\end{array}
Initial program 99.5%
remove-double-neg99.5%
associate--l+99.5%
remove-double-neg99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 67.7%
+-commutative30.7%
remove-double-neg30.7%
log-rec30.7%
mul-1-neg30.7%
associate--l+30.7%
mul-1-neg30.7%
log-rec30.7%
remove-double-neg30.7%
Simplified67.7%
Final simplification67.7%
(FPCore (x y z t a) :precision binary64 (+ (- (log z) t) (+ (log y) (* (log t) (- a 0.5)))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + (log(y) + (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) - t) + (log(y) + (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) - t) + (Math.log(y) + (Math.log(t) * (a - 0.5)));
}
def code(x, y, z, t, a): return (math.log(z) - t) + (math.log(y) + (math.log(t) * (a - 0.5)))
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + Float64(log(y) + Float64(log(t) * Float64(a - 0.5)))) end
function tmp = code(x, y, z, t, a) tmp = (log(z) - t) + (log(y) + (log(t) * (a - 0.5))); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \left(\log y + \log t \cdot \left(a - 0.5\right)\right)
\end{array}
Initial program 99.5%
+-commutative99.5%
associate--l+99.5%
associate-+r+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 67.7%
Final simplification67.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -116000.0) (not (<= a 1.35e-9))) (+ (- (log z) t) (* a (log t))) (- (+ (log (* z (+ x y))) (* -0.5 (log t))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -116000.0) || !(a <= 1.35e-9)) {
tmp = (log(z) - t) + (a * log(t));
} else {
tmp = (log((z * (x + y))) + (-0.5 * 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 ((a <= (-116000.0d0)) .or. (.not. (a <= 1.35d-9))) then
tmp = (log(z) - t) + (a * log(t))
else
tmp = (log((z * (x + y))) + ((-0.5d0) * 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 ((a <= -116000.0) || !(a <= 1.35e-9)) {
tmp = (Math.log(z) - t) + (a * Math.log(t));
} else {
tmp = (Math.log((z * (x + y))) + (-0.5 * Math.log(t))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -116000.0) or not (a <= 1.35e-9): tmp = (math.log(z) - t) + (a * math.log(t)) else: tmp = (math.log((z * (x + y))) + (-0.5 * math.log(t))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -116000.0) || !(a <= 1.35e-9)) tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); else tmp = Float64(Float64(log(Float64(z * Float64(x + y))) + Float64(-0.5 * log(t))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -116000.0) || ~((a <= 1.35e-9))) tmp = (log(z) - t) + (a * log(t)); else tmp = (log((z * (x + y))) + (-0.5 * log(t))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -116000.0], N[Not[LessEqual[a, 1.35e-9]], $MachinePrecision]], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -116000 \lor \neg \left(a \leq 1.35 \cdot 10^{-9}\right):\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + -0.5 \cdot \log t\right) - t\\
\end{array}
\end{array}
if a < -116000 or 1.3500000000000001e-9 < a Initial program 99.7%
+-commutative99.7%
associate--l+99.7%
associate-+r+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 72.3%
Taylor expanded in a around inf 99.5%
*-commutative99.5%
Simplified99.5%
if -116000 < a < 1.3500000000000001e-9Initial program 99.4%
*-un-lft-identity99.4%
+-commutative99.4%
sum-log79.7%
Applied egg-rr79.7%
*-lft-identity79.7%
+-commutative79.7%
Simplified79.7%
Taylor expanded in a around 0 79.6%
Final simplification89.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8.2e-19) (not (<= a 1.9e-9))) (+ (- (log z) t) (* a (log t))) (- (log (* (* z y) (sqrt (/ 1.0 t)))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8.2e-19) || !(a <= 1.9e-9)) {
tmp = (log(z) - t) + (a * log(t));
} else {
tmp = log(((z * y) * sqrt((1.0 / 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 ((a <= (-8.2d-19)) .or. (.not. (a <= 1.9d-9))) then
tmp = (log(z) - t) + (a * log(t))
else
tmp = log(((z * y) * sqrt((1.0d0 / 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 ((a <= -8.2e-19) || !(a <= 1.9e-9)) {
tmp = (Math.log(z) - t) + (a * Math.log(t));
} else {
tmp = Math.log(((z * y) * Math.sqrt((1.0 / t)))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -8.2e-19) or not (a <= 1.9e-9): tmp = (math.log(z) - t) + (a * math.log(t)) else: tmp = math.log(((z * y) * math.sqrt((1.0 / t)))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8.2e-19) || !(a <= 1.9e-9)) tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); else tmp = Float64(log(Float64(Float64(z * y) * sqrt(Float64(1.0 / t)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -8.2e-19) || ~((a <= 1.9e-9))) tmp = (log(z) - t) + (a * log(t)); else tmp = log(((z * y) * sqrt((1.0 / t)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8.2e-19], N[Not[LessEqual[a, 1.9e-9]], $MachinePrecision]], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(N[(z * y), $MachinePrecision] * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.2 \cdot 10^{-19} \lor \neg \left(a \leq 1.9 \cdot 10^{-9}\right):\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\log \left(\left(z \cdot y\right) \cdot \sqrt{\frac{1}{t}}\right) - t\\
\end{array}
\end{array}
if a < -8.1999999999999997e-19 or 1.90000000000000006e-9 < a Initial program 99.7%
+-commutative99.7%
associate--l+99.7%
associate-+r+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 73.1%
Taylor expanded in a around inf 99.6%
*-commutative99.6%
Simplified99.6%
if -8.1999999999999997e-19 < a < 1.90000000000000006e-9Initial program 99.4%
remove-double-neg99.4%
associate--l+99.4%
remove-double-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 61.7%
*-un-lft-identity61.7%
add-log-exp48.3%
associate-+r+48.2%
exp-sum45.4%
sum-log45.7%
add-exp-log45.8%
exp-to-pow45.9%
sub-neg45.9%
metadata-eval45.9%
Applied egg-rr45.9%
*-lft-identity45.9%
Simplified45.9%
Taylor expanded in a around 0 45.9%
Final simplification74.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -116000.0) (not (<= a 1.4e-8))) (+ (- (log z) t) (* a (log t))) (- (+ (log (* z y)) (* -0.5 (log t))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -116000.0) || !(a <= 1.4e-8)) {
tmp = (log(z) - t) + (a * log(t));
} else {
tmp = (log((z * y)) + (-0.5 * 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 ((a <= (-116000.0d0)) .or. (.not. (a <= 1.4d-8))) then
tmp = (log(z) - t) + (a * log(t))
else
tmp = (log((z * y)) + ((-0.5d0) * 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 ((a <= -116000.0) || !(a <= 1.4e-8)) {
tmp = (Math.log(z) - t) + (a * Math.log(t));
} else {
tmp = (Math.log((z * y)) + (-0.5 * Math.log(t))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -116000.0) or not (a <= 1.4e-8): tmp = (math.log(z) - t) + (a * math.log(t)) else: tmp = (math.log((z * y)) + (-0.5 * math.log(t))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -116000.0) || !(a <= 1.4e-8)) tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); else tmp = Float64(Float64(log(Float64(z * y)) + Float64(-0.5 * log(t))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -116000.0) || ~((a <= 1.4e-8))) tmp = (log(z) - t) + (a * log(t)); else tmp = (log((z * y)) + (-0.5 * log(t))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -116000.0], N[Not[LessEqual[a, 1.4e-8]], $MachinePrecision]], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] + N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -116000 \lor \neg \left(a \leq 1.4 \cdot 10^{-8}\right):\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(z \cdot y\right) + -0.5 \cdot \log t\right) - t\\
\end{array}
\end{array}
if a < -116000 or 1.4e-8 < a Initial program 99.7%
+-commutative99.7%
associate--l+99.7%
associate-+r+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 72.3%
Taylor expanded in a around inf 99.5%
*-commutative99.5%
Simplified99.5%
if -116000 < a < 1.4e-8Initial program 99.4%
*-un-lft-identity99.4%
+-commutative99.4%
sum-log79.7%
Applied egg-rr79.7%
*-lft-identity79.7%
+-commutative79.7%
Simplified79.7%
Taylor expanded in a around 0 79.6%
Taylor expanded in x around 0 50.5%
*-commutative50.5%
*-commutative50.5%
Simplified50.5%
Final simplification75.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 1750000000000.0) (+ (* (log t) (- a 0.5)) (- (log (* z (+ x y))) t)) (+ (- (log z) t) (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1750000000000.0) {
tmp = (log(t) * (a - 0.5)) + (log((z * (x + y))) - t);
} else {
tmp = (log(z) - 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 (t <= 1750000000000.0d0) then
tmp = (log(t) * (a - 0.5d0)) + (log((z * (x + y))) - t)
else
tmp = (log(z) - 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 (t <= 1750000000000.0) {
tmp = (Math.log(t) * (a - 0.5)) + (Math.log((z * (x + y))) - t);
} else {
tmp = (Math.log(z) - t) + (a * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1750000000000.0: tmp = (math.log(t) * (a - 0.5)) + (math.log((z * (x + y))) - t) else: tmp = (math.log(z) - t) + (a * math.log(t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1750000000000.0) tmp = Float64(Float64(log(t) * Float64(a - 0.5)) + Float64(log(Float64(z * Float64(x + y))) - t)); else tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1750000000000.0) tmp = (log(t) * (a - 0.5)) + (log((z * (x + y))) - t); else tmp = (log(z) - t) + (a * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1750000000000.0], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1750000000000:\\
\;\;\;\;\log t \cdot \left(a - 0.5\right) + \left(\log \left(z \cdot \left(x + y\right)\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\end{array}
\end{array}
if t < 1.75e12Initial program 99.2%
*-un-lft-identity99.2%
+-commutative99.2%
sum-log77.5%
Applied egg-rr77.5%
*-lft-identity77.5%
+-commutative77.5%
Simplified77.5%
if 1.75e12 < t Initial program 99.9%
+-commutative99.9%
associate--l+99.9%
associate-+r+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 72.5%
Taylor expanded in a around inf 99.8%
*-commutative99.8%
Simplified99.8%
Final simplification89.3%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.85e+48) (+ (log (+ x y)) (* a (log t))) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.85e+48) {
tmp = log((x + y)) + (a * log(t));
} else {
tmp = -t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 1.85d+48) then
tmp = log((x + y)) + (a * log(t))
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.85e+48) {
tmp = Math.log((x + y)) + (a * Math.log(t));
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.85e+48: tmp = math.log((x + y)) + (a * math.log(t)) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.85e+48) tmp = Float64(log(Float64(x + y)) + Float64(a * log(t))); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.85e+48) tmp = log((x + y)) + (a * log(t)); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.85e+48], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.85 \cdot 10^{+48}:\\
\;\;\;\;\log \left(x + y\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 1.85e48Initial 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.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in a around inf 55.3%
*-commutative55.3%
Simplified55.3%
if 1.85e48 < t Initial program 99.9%
+-commutative99.9%
associate--l+99.9%
associate-+r+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 72.1%
Taylor expanded in t around inf 79.4%
mul-1-neg79.4%
Simplified79.4%
Final simplification66.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.5%
+-commutative99.5%
associate--l+99.5%
associate-+r+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 67.7%
Taylor expanded in a around inf 78.0%
*-commutative78.0%
Simplified78.0%
Final simplification78.0%
(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(log(z) + Float64(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[Log[z], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log z + \left(\log y - t\right)
\end{array}
Initial 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 44.0%
Taylor expanded in x around 0 30.7%
+-commutative30.7%
remove-double-neg30.7%
log-rec30.7%
mul-1-neg30.7%
associate--l+30.7%
mul-1-neg30.7%
log-rec30.7%
remove-double-neg30.7%
Simplified30.7%
Final simplification30.7%
(FPCore (x y z t a) :precision binary64 (- (log (+ x y)) t))
double code(double x, double y, double z, double t, double a) {
return log((x + 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((x + y)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return Math.log((x + y)) - t;
}
def code(x, y, z, t, a): return math.log((x + y)) - t
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) - t) end
function tmp = code(x, y, z, t, a) tmp = log((x + y)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) - t
\end{array}
Initial 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 43.3%
neg-mul-143.3%
Simplified43.3%
Final simplification43.3%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.5%
+-commutative99.5%
associate--l+99.5%
associate-+r+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 67.7%
Taylor expanded in t around inf 40.2%
mul-1-neg40.2%
Simplified40.2%
Final simplification40.2%
(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 2024055
(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))))