
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (log (/ 1.0 t)) (- 0.5 a))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + (log((1.0 / t)) * (0.5 - a));
}
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) + (log((1.0d0 / t)) * (0.5d0 - a))
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) + (Math.log((1.0 / t)) * (0.5 - a));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + (math.log((1.0 / t)) * (0.5 - a))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(log(Float64(1.0 / t)) * Float64(0.5 - a))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + (log((1.0 / t)) * (0.5 - a)); 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[Log[N[(1.0 / t), $MachinePrecision]], $MachinePrecision] * N[(0.5 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \log \left(\frac{1}{t}\right) \cdot \left(0.5 - a\right)
\end{array}
Initial program 99.6%
Taylor expanded in t around inf 99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 22.5) (+ (log z) (+ (log (+ x y)) (* (- 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 <= 22.5) {
tmp = log(z) + (log((x + y)) + ((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 <= 22.5d0) then
tmp = log(z) + (log((x + y)) + ((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 <= 22.5) {
tmp = Math.log(z) + (Math.log((x + y)) + ((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 <= 22.5: tmp = math.log(z) + (math.log((x + y)) + ((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 <= 22.5) tmp = Float64(log(z) + Float64(log(Float64(x + y)) + 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 <= 22.5) tmp = log(z) + (log((x + y)) + ((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, 22.5], N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $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 22.5:\\
\;\;\;\;\log z + \left(\log \left(x + y\right) + \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 < 22.5Initial program 99.3%
associate--l+99.3%
+-commutative99.3%
associate-+l+99.3%
+-commutative99.3%
fma-def99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in t around 0 98.1%
if 22.5 < t Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around inf 99.0%
*-commutative99.0%
Simplified99.0%
Final simplification98.5%
(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 22.5) (+ (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 <= 22.5) {
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 <= 22.5d0) 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 <= 22.5) {
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 <= 22.5: 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 <= 22.5) 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 <= 22.5) 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, 22.5], 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 22.5:\\
\;\;\;\;\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 < 22.5Initial program 99.3%
Taylor expanded in x around 0 64.3%
Taylor expanded in t around 0 63.9%
if 22.5 < t Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around inf 99.0%
*-commutative99.0%
Simplified99.0%
Final simplification79.4%
(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 67.2%
Final simplification67.2%
(FPCore (x y z t a)
:precision binary64
(if (or (<= a -1.1e-15)
(not
(or (<= a -1.65e-128) (and (not (<= a 2.35e-112)) (<= a 1.8e-78)))))
(+ (- (log z) t) (* a (log t)))
(+ (log (* y z)) (* (log t) -0.5))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.1e-15) || !((a <= -1.65e-128) || (!(a <= 2.35e-112) && (a <= 1.8e-78)))) {
tmp = (log(z) - t) + (a * log(t));
} else {
tmp = log((y * z)) + (log(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) :: tmp
if ((a <= (-1.1d-15)) .or. (.not. (a <= (-1.65d-128)) .or. (.not. (a <= 2.35d-112)) .and. (a <= 1.8d-78))) then
tmp = (log(z) - t) + (a * log(t))
else
tmp = log((y * z)) + (log(t) * (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.1e-15) || !((a <= -1.65e-128) || (!(a <= 2.35e-112) && (a <= 1.8e-78)))) {
tmp = (Math.log(z) - t) + (a * Math.log(t));
} else {
tmp = Math.log((y * z)) + (Math.log(t) * -0.5);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.1e-15) or not ((a <= -1.65e-128) or (not (a <= 2.35e-112) and (a <= 1.8e-78))): tmp = (math.log(z) - t) + (a * math.log(t)) else: tmp = math.log((y * z)) + (math.log(t) * -0.5) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.1e-15) || !((a <= -1.65e-128) || (!(a <= 2.35e-112) && (a <= 1.8e-78)))) tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); else tmp = Float64(log(Float64(y * z)) + Float64(log(t) * -0.5)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.1e-15) || ~(((a <= -1.65e-128) || (~((a <= 2.35e-112)) && (a <= 1.8e-78))))) tmp = (log(z) - t) + (a * log(t)); else tmp = log((y * z)) + (log(t) * -0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.1e-15], N[Not[Or[LessEqual[a, -1.65e-128], And[N[Not[LessEqual[a, 2.35e-112]], $MachinePrecision], LessEqual[a, 1.8e-78]]]], $MachinePrecision]], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{-15} \lor \neg \left(a \leq -1.65 \cdot 10^{-128} \lor \neg \left(a \leq 2.35 \cdot 10^{-112}\right) \land a \leq 1.8 \cdot 10^{-78}\right):\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot z\right) + \log t \cdot -0.5\\
\end{array}
\end{array}
if a < -1.09999999999999993e-15 or -1.65e-128 < a < 2.3500000000000002e-112 or 1.8000000000000001e-78 < a Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.6%
+-commutative99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in a around inf 81.4%
*-commutative81.4%
Simplified81.4%
if -1.09999999999999993e-15 < a < -1.65e-128 or 2.3500000000000002e-112 < a < 1.8000000000000001e-78Initial program 99.1%
Taylor expanded in x around 0 62.4%
Taylor expanded in a around 0 62.4%
Taylor expanded in t around 0 46.9%
log-pow46.9%
associate-+r+46.9%
log-prod42.2%
log-pow42.2%
*-commutative42.2%
Simplified42.2%
Final simplification74.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -9.5e-11) (not (<= a 1.7e-11))) (+ (- (log z) t) (* a (log t))) (- (log (* (+ x y) (* z (pow t -0.5)))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -9.5e-11) || !(a <= 1.7e-11)) {
tmp = (log(z) - t) + (a * log(t));
} else {
tmp = log(((x + y) * (z * pow(t, -0.5)))) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-9.5d-11)) .or. (.not. (a <= 1.7d-11))) then
tmp = (log(z) - t) + (a * log(t))
else
tmp = log(((x + y) * (z * (t ** (-0.5d0))))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -9.5e-11) || !(a <= 1.7e-11)) {
tmp = (Math.log(z) - t) + (a * Math.log(t));
} else {
tmp = Math.log(((x + y) * (z * Math.pow(t, -0.5)))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -9.5e-11) or not (a <= 1.7e-11): tmp = (math.log(z) - t) + (a * math.log(t)) else: tmp = math.log(((x + y) * (z * math.pow(t, -0.5)))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -9.5e-11) || !(a <= 1.7e-11)) tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); else tmp = Float64(log(Float64(Float64(x + y) * Float64(z * (t ^ -0.5)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -9.5e-11) || ~((a <= 1.7e-11))) tmp = (log(z) - t) + (a * log(t)); else tmp = log(((x + y) * (z * (t ^ -0.5)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -9.5e-11], N[Not[LessEqual[a, 1.7e-11]], $MachinePrecision]], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(N[(x + y), $MachinePrecision] * N[(z * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.5 \cdot 10^{-11} \lor \neg \left(a \leq 1.7 \cdot 10^{-11}\right):\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot \left(z \cdot {t}^{-0.5}\right)\right) - t\\
\end{array}
\end{array}
if a < -9.49999999999999951e-11 or 1.6999999999999999e-11 < a Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 97.1%
*-commutative97.1%
Simplified97.1%
if -9.49999999999999951e-11 < a < 1.6999999999999999e-11Initial program 99.4%
Taylor expanded in t around inf 99.4%
add-exp-log59.1%
log-rec59.1%
Applied egg-rr59.1%
Taylor expanded in a around 0 99.4%
log-pow99.4%
log-prod87.8%
log-prod76.5%
*-commutative76.5%
associate-*l*79.6%
+-commutative79.6%
Simplified79.6%
Final simplification88.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (* y z)) (* (log t) -0.5))))
(if (<= t 6.8e-280)
t_1
(if (<= t 1.5e-57)
(* a (log t))
(if (<= t 1.3e-15)
t_1
(if (<= t 1.6e+51) (* (log (/ 1.0 t)) (- a)) (- t)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((y * z)) + (log(t) * -0.5);
double tmp;
if (t <= 6.8e-280) {
tmp = t_1;
} else if (t <= 1.5e-57) {
tmp = a * log(t);
} else if (t <= 1.3e-15) {
tmp = t_1;
} else if (t <= 1.6e+51) {
tmp = log((1.0 / t)) * -a;
} 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) :: t_1
real(8) :: tmp
t_1 = log((y * z)) + (log(t) * (-0.5d0))
if (t <= 6.8d-280) then
tmp = t_1
else if (t <= 1.5d-57) then
tmp = a * log(t)
else if (t <= 1.3d-15) then
tmp = t_1
else if (t <= 1.6d+51) then
tmp = log((1.0d0 / t)) * -a
else
tmp = -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((y * z)) + (Math.log(t) * -0.5);
double tmp;
if (t <= 6.8e-280) {
tmp = t_1;
} else if (t <= 1.5e-57) {
tmp = a * Math.log(t);
} else if (t <= 1.3e-15) {
tmp = t_1;
} else if (t <= 1.6e+51) {
tmp = Math.log((1.0 / t)) * -a;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((y * z)) + (math.log(t) * -0.5) tmp = 0 if t <= 6.8e-280: tmp = t_1 elif t <= 1.5e-57: tmp = a * math.log(t) elif t <= 1.3e-15: tmp = t_1 elif t <= 1.6e+51: tmp = math.log((1.0 / t)) * -a else: tmp = -t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(Float64(y * z)) + Float64(log(t) * -0.5)) tmp = 0.0 if (t <= 6.8e-280) tmp = t_1; elseif (t <= 1.5e-57) tmp = Float64(a * log(t)); elseif (t <= 1.3e-15) tmp = t_1; elseif (t <= 1.6e+51) tmp = Float64(log(Float64(1.0 / t)) * Float64(-a)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((y * z)) + (log(t) * -0.5); tmp = 0.0; if (t <= 6.8e-280) tmp = t_1; elseif (t <= 1.5e-57) tmp = a * log(t); elseif (t <= 1.3e-15) tmp = t_1; elseif (t <= 1.6e+51) tmp = log((1.0 / t)) * -a; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 6.8e-280], t$95$1, If[LessEqual[t, 1.5e-57], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.3e-15], t$95$1, If[LessEqual[t, 1.6e+51], N[(N[Log[N[(1.0 / t), $MachinePrecision]], $MachinePrecision] * (-a)), $MachinePrecision], (-t)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(y \cdot z\right) + \log t \cdot -0.5\\
\mathbf{if}\;t \leq 6.8 \cdot 10^{-280}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{-57}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{-15}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+51}:\\
\;\;\;\;\log \left(\frac{1}{t}\right) \cdot \left(-a\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 6.7999999999999995e-280 or 1.5e-57 < t < 1.30000000000000002e-15Initial program 98.9%
Taylor expanded in x around 0 63.5%
Taylor expanded in a around 0 41.7%
Taylor expanded in t around 0 41.8%
log-pow41.8%
associate-+r+41.7%
log-prod38.4%
log-pow38.4%
*-commutative38.4%
Simplified38.4%
if 6.7999999999999995e-280 < t < 1.5e-57Initial program 99.4%
Taylor expanded in t around inf 99.4%
Taylor expanded in a around inf 53.6%
mul-1-neg53.6%
log-rec53.6%
distribute-rgt-neg-in53.6%
remove-double-neg53.6%
Simplified53.6%
if 1.30000000000000002e-15 < t < 1.6000000000000001e51Initial program 99.6%
Taylor expanded in t around inf 99.7%
Taylor expanded in a around inf 64.2%
if 1.6000000000000001e51 < t Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 83.5%
neg-mul-183.5%
Simplified83.5%
Final simplification63.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.5e-9) (not (<= a 1.7e-11))) (+ (- (log z) t) (* a (log t))) (- (log (* y (* z (pow t -0.5)))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.5e-9) || !(a <= 1.7e-11)) {
tmp = (log(z) - t) + (a * log(t));
} else {
tmp = log((y * (z * pow(t, -0.5)))) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-1.5d-9)) .or. (.not. (a <= 1.7d-11))) then
tmp = (log(z) - t) + (a * log(t))
else
tmp = log((y * (z * (t ** (-0.5d0))))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.5e-9) || !(a <= 1.7e-11)) {
tmp = (Math.log(z) - t) + (a * Math.log(t));
} else {
tmp = Math.log((y * (z * Math.pow(t, -0.5)))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.5e-9) or not (a <= 1.7e-11): tmp = (math.log(z) - t) + (a * math.log(t)) else: tmp = math.log((y * (z * math.pow(t, -0.5)))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.5e-9) || !(a <= 1.7e-11)) tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); else tmp = Float64(log(Float64(y * Float64(z * (t ^ -0.5)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.5e-9) || ~((a <= 1.7e-11))) tmp = (log(z) - t) + (a * log(t)); else tmp = log((y * (z * (t ^ -0.5)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.5e-9], N[Not[LessEqual[a, 1.7e-11]], $MachinePrecision]], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(y * N[(z * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.5 \cdot 10^{-9} \lor \neg \left(a \leq 1.7 \cdot 10^{-11}\right):\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot \left(z \cdot {t}^{-0.5}\right)\right) - t\\
\end{array}
\end{array}
if a < -1.49999999999999999e-9 or 1.6999999999999999e-11 < a Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in a around inf 97.1%
*-commutative97.1%
Simplified97.1%
if -1.49999999999999999e-9 < a < 1.6999999999999999e-11Initial program 99.4%
Taylor expanded in x around 0 62.8%
Taylor expanded in a around 0 62.8%
Taylor expanded in y around 0 62.8%
log-pow62.8%
associate-+r+62.8%
log-prod48.4%
associate--l+48.4%
unsub-neg48.4%
+-commutative48.4%
neg-sub048.4%
associate-+l-48.4%
neg-sub048.4%
sub-neg48.4%
associate--r-48.4%
rem-log-exp28.4%
log-div29.0%
log-prod26.6%
*-commutative26.6%
associate-*r/26.6%
log-div26.2%
Simplified49.5%
Final simplification74.2%
(FPCore (x y z t a) :precision binary64 (if (<= t 2.35e+51) (* (log (/ 1.0 t)) (- a)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.35e+51) {
tmp = log((1.0 / t)) * -a;
} 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 <= 2.35d+51) then
tmp = log((1.0d0 / t)) * -a
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 <= 2.35e+51) {
tmp = Math.log((1.0 / t)) * -a;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2.35e+51: tmp = math.log((1.0 / t)) * -a else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2.35e+51) tmp = Float64(log(Float64(1.0 / t)) * Float64(-a)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 2.35e+51) tmp = log((1.0 / t)) * -a; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.35e+51], N[(N[Log[N[(1.0 / t), $MachinePrecision]], $MachinePrecision] * (-a)), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.35 \cdot 10^{+51}:\\
\;\;\;\;\log \left(\frac{1}{t}\right) \cdot \left(-a\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 2.3500000000000001e51Initial program 99.4%
Taylor expanded in t around inf 99.4%
Taylor expanded in a around inf 49.6%
if 2.3500000000000001e51 < t Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 83.5%
neg-mul-183.5%
Simplified83.5%
Final simplification61.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 2.7e+51) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.7e+51) {
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 (t <= 2.7d+51) 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 (t <= 2.7e+51) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2.7e+51: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2.7e+51) 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 (t <= 2.7e+51) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.7e+51], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.7 \cdot 10^{+51}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 2.69999999999999992e51Initial program 99.4%
Taylor expanded in t around inf 99.4%
Taylor expanded in a around inf 49.6%
mul-1-neg49.6%
log-rec49.6%
distribute-rgt-neg-in49.6%
remove-double-neg49.6%
Simplified49.6%
if 2.69999999999999992e51 < t Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 83.5%
neg-mul-183.5%
Simplified83.5%
Final simplification61.4%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.6%
+-commutative99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in t around inf 33.5%
neg-mul-133.5%
Simplified33.5%
Final simplification33.5%
(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 2023320
(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))))