
(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 11 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) (+ (log y) (+ (log z) (* (- a 0.5) (log t)))) (+ (- (log z) t) (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.16) {
tmp = log(y) + (log(z) + ((a - 0.5) * log(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 <= 0.16d0) then
tmp = log(y) + (log(z) + ((a - 0.5d0) * log(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 <= 0.16) {
tmp = Math.log(y) + (Math.log(z) + ((a - 0.5) * Math.log(t)));
} else {
tmp = (Math.log(z) - t) + (a * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.16: tmp = math.log(y) + (math.log(z) + ((a - 0.5) * math.log(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 <= 0.16) tmp = Float64(log(y) + Float64(log(z) + Float64(Float64(a - 0.5) * log(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 <= 0.16) tmp = log(y) + (log(z) + ((a - 0.5) * log(t))); else tmp = (log(z) - t) + (a * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.16], 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[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.16:\\
\;\;\;\;\log y + \left(\log z + \left(a - 0.5\right) \cdot \log t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\end{array}
\end{array}
if t < 0.160000000000000003Initial program 99.3%
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 a around inf 99.2%
*-commutative99.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(a - 0.5) * log(t)) + Float64(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[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(a - 0.5\right) \cdot \log t + \left(\left(\log z + \log y\right) - t\right)
\end{array}
Initial program 99.6%
Taylor expanded in x around 0 66.9%
Final simplification66.9%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.16) (- (+ (log (* (+ x y) z)) (* (log t) (+ a -0.5))) t) (+ (- (log z) t) (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.16) {
tmp = (log(((x + y) * z)) + (log(t) * (a + -0.5))) - 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 <= 0.16d0) then
tmp = (log(((x + y) * z)) + (log(t) * (a + (-0.5d0)))) - 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 <= 0.16) {
tmp = (Math.log(((x + y) * z)) + (Math.log(t) * (a + -0.5))) - t;
} else {
tmp = (Math.log(z) - t) + (a * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.16: tmp = (math.log(((x + y) * z)) + (math.log(t) * (a + -0.5))) - 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 <= 0.16) tmp = Float64(Float64(log(Float64(Float64(x + y) * z)) + Float64(log(t) * Float64(a + -0.5))) - 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 <= 0.16) tmp = (log(((x + y) * z)) + (log(t) * (a + -0.5))) - t; else tmp = (log(z) - t) + (a * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.16], N[(N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $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 0.16:\\
\;\;\;\;\left(\log \left(\left(x + y\right) \cdot z\right) + \log t \cdot \left(a + -0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\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 a around inf 99.2%
*-commutative99.2%
Simplified99.2%
Final simplification88.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* a (log t))) (t_2 (- (log z) t)))
(if (<= a -3.2e+100)
t_1
(if (<= a -1.85e-93)
t_2
(if (<= a -3.5e-161)
(+ (* (log t) -0.5) (log (* y z)))
(if (<= a 5.5e+54) t_2 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a * log(t);
double t_2 = log(z) - t;
double tmp;
if (a <= -3.2e+100) {
tmp = t_1;
} else if (a <= -1.85e-93) {
tmp = t_2;
} else if (a <= -3.5e-161) {
tmp = (log(t) * -0.5) + log((y * z));
} else if (a <= 5.5e+54) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_1 = a * log(t)
t_2 = log(z) - t
if (a <= (-3.2d+100)) then
tmp = t_1
else if (a <= (-1.85d-93)) then
tmp = t_2
else if (a <= (-3.5d-161)) then
tmp = (log(t) * (-0.5d0)) + log((y * z))
else if (a <= 5.5d+54) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a * Math.log(t);
double t_2 = Math.log(z) - t;
double tmp;
if (a <= -3.2e+100) {
tmp = t_1;
} else if (a <= -1.85e-93) {
tmp = t_2;
} else if (a <= -3.5e-161) {
tmp = (Math.log(t) * -0.5) + Math.log((y * z));
} else if (a <= 5.5e+54) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a * math.log(t) t_2 = math.log(z) - t tmp = 0 if a <= -3.2e+100: tmp = t_1 elif a <= -1.85e-93: tmp = t_2 elif a <= -3.5e-161: tmp = (math.log(t) * -0.5) + math.log((y * z)) elif a <= 5.5e+54: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(a * log(t)) t_2 = Float64(log(z) - t) tmp = 0.0 if (a <= -3.2e+100) tmp = t_1; elseif (a <= -1.85e-93) tmp = t_2; elseif (a <= -3.5e-161) tmp = Float64(Float64(log(t) * -0.5) + log(Float64(y * z))); elseif (a <= 5.5e+54) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a * log(t); t_2 = log(z) - t; tmp = 0.0; if (a <= -3.2e+100) tmp = t_1; elseif (a <= -1.85e-93) tmp = t_2; elseif (a <= -3.5e-161) tmp = (log(t) * -0.5) + log((y * z)); elseif (a <= 5.5e+54) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[a, -3.2e+100], t$95$1, If[LessEqual[a, -1.85e-93], t$95$2, If[LessEqual[a, -3.5e-161], N[(N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.5e+54], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \log t\\
t_2 := \log z - t\\
\mathbf{if}\;a \leq -3.2 \cdot 10^{+100}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -1.85 \cdot 10^{-93}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \leq -3.5 \cdot 10^{-161}:\\
\;\;\;\;\log t \cdot -0.5 + \log \left(y \cdot z\right)\\
\mathbf{elif}\;a \leq 5.5 \cdot 10^{+54}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if a < -3.1999999999999999e100 or 5.50000000000000026e54 < a Initial program 99.5%
Taylor expanded in x around 0 70.0%
Taylor expanded in a around inf 83.9%
*-commutative83.9%
Simplified83.9%
if -3.1999999999999999e100 < a < -1.85000000000000001e-93 or -3.5000000000000002e-161 < a < 5.50000000000000026e54Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.6%
+-commutative99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in a around inf 72.6%
*-commutative72.6%
Simplified72.6%
Taylor expanded in a around 0 65.1%
if -1.85000000000000001e-93 < a < -3.5000000000000002e-161Initial program 98.9%
Taylor expanded in x around 0 50.0%
Taylor expanded in t around 0 41.0%
Taylor expanded in a around 0 41.0%
associate-+r+40.9%
log-prod35.5%
+-commutative35.5%
*-commutative35.5%
Simplified35.5%
Final simplification68.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.0092) (+ (* (log t) (+ a -0.5)) (log (* y z))) (+ (- (log z) t) (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.0092) {
tmp = (log(t) * (a + -0.5)) + log((y * z));
} 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 <= 0.0092d0) then
tmp = (log(t) * (a + (-0.5d0))) + log((y * z))
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 <= 0.0092) {
tmp = (Math.log(t) * (a + -0.5)) + Math.log((y * z));
} else {
tmp = (Math.log(z) - t) + (a * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.0092: tmp = (math.log(t) * (a + -0.5)) + math.log((y * z)) else: tmp = (math.log(z) - t) + (a * math.log(t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.0092) tmp = Float64(Float64(log(t) * Float64(a + -0.5)) + log(Float64(y * z))); 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 <= 0.0092) tmp = (log(t) * (a + -0.5)) + log((y * z)); else tmp = (log(z) - t) + (a * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.0092], N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(y * z), $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 0.0092:\\
\;\;\;\;\log t \cdot \left(a + -0.5\right) + \log \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\end{array}
\end{array}
if t < 0.0091999999999999998Initial program 99.3%
Taylor expanded in x around 0 58.9%
Taylor expanded in t around 0 58.9%
associate-+r+58.9%
log-prod48.2%
*-commutative48.2%
sub-neg48.2%
metadata-eval48.2%
Simplified48.2%
if 0.0091999999999999998 < 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 a around inf 99.2%
*-commutative99.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 (if (or (<= a -5.4e+100) (not (<= a 2.5e+53))) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.4e+100) || !(a <= 2.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 <= (-5.4d+100)) .or. (.not. (a <= 2.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 <= -5.4e+100) || !(a <= 2.5e+53)) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5.4e+100) or not (a <= 2.5e+53): tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.4e+100) || !(a <= 2.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 <= -5.4e+100) || ~((a <= 2.5e+53))) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.4e+100], N[Not[LessEqual[a, 2.5e+53]], $MachinePrecision]], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{+100} \lor \neg \left(a \leq 2.5 \cdot 10^{+53}\right):\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if a < -5.39999999999999997e100 or 2.5000000000000002e53 < a Initial program 99.5%
Taylor expanded in x around 0 70.0%
Taylor expanded in a around inf 83.9%
*-commutative83.9%
Simplified83.9%
if -5.39999999999999997e100 < a < 2.5000000000000002e53Initial 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 (if (or (<= a -5.4e+100) (not (<= a 6.5e+54))) (* a (log t)) (- (log z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.4e+100) || !(a <= 6.5e+54)) {
tmp = a * log(t);
} else {
tmp = 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 <= (-5.4d+100)) .or. (.not. (a <= 6.5d+54))) then
tmp = a * log(t)
else
tmp = 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 <= -5.4e+100) || !(a <= 6.5e+54)) {
tmp = a * Math.log(t);
} else {
tmp = Math.log(z) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5.4e+100) or not (a <= 6.5e+54): tmp = a * math.log(t) else: tmp = math.log(z) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.4e+100) || !(a <= 6.5e+54)) tmp = Float64(a * log(t)); else tmp = Float64(log(z) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -5.4e+100) || ~((a <= 6.5e+54))) tmp = a * log(t); else tmp = log(z) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.4e+100], N[Not[LessEqual[a, 6.5e+54]], $MachinePrecision]], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{+100} \lor \neg \left(a \leq 6.5 \cdot 10^{+54}\right):\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\log z - t\\
\end{array}
\end{array}
if a < -5.39999999999999997e100 or 6.5e54 < a Initial program 99.5%
Taylor expanded in x around 0 70.0%
Taylor expanded in a around inf 83.9%
*-commutative83.9%
Simplified83.9%
if -5.39999999999999997e100 < a < 6.5e54Initial 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 66.5%
*-commutative66.5%
Simplified66.5%
Taylor expanded in a around 0 59.9%
Final simplification67.8%
(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))))