
(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 (+ x y)) (log z)) t) (* (log t) (- a 0.5))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + (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((x + y)) + log(z)) - t) + (log(t) * (a - 0.5d0))
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(t) * (a - 0.5));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + (math.log(t) * (a - 0.5))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(log(t) * Float64(a - 0.5))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + (log(t) * (a - 0.5)); 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[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \log t \cdot \left(a - 0.5\right)
\end{array}
Initial program 99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (<= (log z) 230.0) (- (+ (log (* (+ x y) z)) (* (log t) (- a 0.5))) t) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (log(z) <= 230.0) {
tmp = (log(((x + y) * z)) + (log(t) * (a - 0.5))) - t;
} else {
tmp = (a * log(t)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (log(z) <= 230.0d0) then
tmp = (log(((x + y) * z)) + (log(t) * (a - 0.5d0))) - t
else
tmp = (a * log(t)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (Math.log(z) <= 230.0) {
tmp = (Math.log(((x + y) * z)) + (Math.log(t) * (a - 0.5))) - t;
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.log(z) <= 230.0: tmp = (math.log(((x + y) * z)) + (math.log(t) * (a - 0.5))) - t else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (log(z) <= 230.0) tmp = Float64(Float64(log(Float64(Float64(x + y) * z)) + Float64(log(t) * Float64(a - 0.5))) - t); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (log(z) <= 230.0) tmp = (log(((x + y) * z)) + (log(t) * (a - 0.5))) - t; else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Log[z], $MachinePrecision], 230.0], 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[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log z \leq 230:\\
\;\;\;\;\left(\log \left(\left(x + y\right) \cdot z\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if (log.f64 z) < 230Initial program 99.7%
associate-+l-99.7%
+-commutative99.7%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-def99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
associate-+r-99.7%
+-commutative99.7%
fma-udef99.7%
associate--r+99.7%
+-commutative99.7%
sum-log96.2%
Applied egg-rr96.2%
if 230 < (log.f64 z) Initial program 99.6%
Taylor expanded in x around 0 63.0%
Taylor expanded in a around inf 80.5%
*-commutative80.5%
Simplified80.5%
Final simplification90.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1450000000.0) (not (<= a 0.64))) (- (* a (log t)) t) (- (+ (log z) (log (* y (sqrt (/ 1.0 t))))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1450000000.0) || !(a <= 0.64)) {
tmp = (a * log(t)) - t;
} else {
tmp = (log(z) + log((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 <= (-1450000000.0d0)) .or. (.not. (a <= 0.64d0))) then
tmp = (a * log(t)) - t
else
tmp = (log(z) + log((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 <= -1450000000.0) || !(a <= 0.64)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = (Math.log(z) + Math.log((y * Math.sqrt((1.0 / t))))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1450000000.0) or not (a <= 0.64): tmp = (a * math.log(t)) - t else: tmp = (math.log(z) + math.log((y * math.sqrt((1.0 / t))))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1450000000.0) || !(a <= 0.64)) tmp = Float64(Float64(a * log(t)) - t); else tmp = Float64(Float64(log(z) + log(Float64(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 <= -1450000000.0) || ~((a <= 0.64))) tmp = (a * log(t)) - t; else tmp = (log(z) + log((y * sqrt((1.0 / t))))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1450000000.0], N[Not[LessEqual[a, 0.64]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] + N[Log[N[(y * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1450000000 \lor \neg \left(a \leq 0.64\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z + \log \left(y \cdot \sqrt{\frac{1}{t}}\right)\right) - t\\
\end{array}
\end{array}
if a < -1.45e9 or 0.640000000000000013 < a Initial program 99.7%
Taylor expanded in x around 0 63.9%
Taylor expanded in a around inf 98.7%
*-commutative98.7%
Simplified98.7%
if -1.45e9 < a < 0.640000000000000013Initial program 99.5%
Taylor expanded in a around 0 97.6%
associate-+r+97.7%
log-prod77.3%
add-log-exp77.3%
sum-log69.4%
+-commutative69.4%
*-commutative69.4%
exp-to-pow69.5%
Applied egg-rr69.5%
Taylor expanded in y around inf 46.0%
Taylor expanded in z around 0 59.0%
Final simplification80.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1450000000.0) (not (<= a 2.2))) (- (* a (log t)) t) (- (+ (log z) (+ (log y) (* (log t) -0.5))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1450000000.0) || !(a <= 2.2)) {
tmp = (a * log(t)) - t;
} else {
tmp = (log(z) + (log(y) + (log(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 <= (-1450000000.0d0)) .or. (.not. (a <= 2.2d0))) then
tmp = (a * log(t)) - t
else
tmp = (log(z) + (log(y) + (log(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 <= -1450000000.0) || !(a <= 2.2)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = (Math.log(z) + (Math.log(y) + (Math.log(t) * -0.5))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1450000000.0) or not (a <= 2.2): tmp = (a * math.log(t)) - t else: tmp = (math.log(z) + (math.log(y) + (math.log(t) * -0.5))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1450000000.0) || !(a <= 2.2)) tmp = Float64(Float64(a * log(t)) - t); else tmp = Float64(Float64(log(z) + Float64(log(y) + Float64(log(t) * -0.5))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1450000000.0) || ~((a <= 2.2))) tmp = (a * log(t)) - t; else tmp = (log(z) + (log(y) + (log(t) * -0.5))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1450000000.0], N[Not[LessEqual[a, 2.2]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1450000000 \lor \neg \left(a \leq 2.2\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z + \left(\log y + \log t \cdot -0.5\right)\right) - t\\
\end{array}
\end{array}
if a < -1.45e9 or 2.2000000000000002 < a Initial program 99.7%
Taylor expanded in x around 0 63.9%
Taylor expanded in a around inf 98.7%
*-commutative98.7%
Simplified98.7%
if -1.45e9 < a < 2.2000000000000002Initial program 99.5%
Taylor expanded in a around 0 97.6%
Taylor expanded in x around 0 66.0%
*-commutative66.0%
Simplified66.0%
Final simplification83.4%
(FPCore (x y z t a) :precision binary64 (if (<= (log z) 230.0) (- (+ (log (* y z)) (* (log t) (- a 0.5))) t) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (log(z) <= 230.0) {
tmp = (log((y * z)) + (log(t) * (a - 0.5))) - t;
} else {
tmp = (a * log(t)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (log(z) <= 230.0d0) then
tmp = (log((y * z)) + (log(t) * (a - 0.5d0))) - t
else
tmp = (a * log(t)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (Math.log(z) <= 230.0) {
tmp = (Math.log((y * z)) + (Math.log(t) * (a - 0.5))) - t;
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.log(z) <= 230.0: tmp = (math.log((y * z)) + (math.log(t) * (a - 0.5))) - t else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (log(z) <= 230.0) tmp = Float64(Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5))) - t); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (log(z) <= 230.0) tmp = (log((y * z)) + (log(t) * (a - 0.5))) - t; else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Log[z], $MachinePrecision], 230.0], N[(N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log z \leq 230:\\
\;\;\;\;\left(\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if (log.f64 z) < 230Initial program 99.7%
associate-+l-99.7%
+-commutative99.7%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-def99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
associate-+r-99.7%
+-commutative99.7%
fma-udef99.7%
associate--r+99.7%
+-commutative99.7%
sum-log96.2%
Applied egg-rr96.2%
Taylor expanded in x around 0 62.7%
if 230 < (log.f64 z) Initial program 99.6%
Taylor expanded in x around 0 63.0%
Taylor expanded in a around inf 80.5%
*-commutative80.5%
Simplified80.5%
Final simplification69.1%
(FPCore (x y z t a) :precision binary64 (+ (log z) (- (log y) (+ t (* (log t) (- 0.5 a))))))
double code(double x, double y, double z, double t, double a) {
return log(z) + (log(y) - (t + (log(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(z) + (log(y) - (t + (log(t) * (0.5d0 - a))))
end function
public static double code(double x, double y, double z, double t, double a) {
return Math.log(z) + (Math.log(y) - (t + (Math.log(t) * (0.5 - a))));
}
def code(x, y, z, t, a): return math.log(z) + (math.log(y) - (t + (math.log(t) * (0.5 - a))))
function code(x, y, z, t, a) return Float64(log(z) + Float64(log(y) - Float64(t + Float64(log(t) * Float64(0.5 - a))))) end
function tmp = code(x, y, z, t, a) tmp = log(z) + (log(y) - (t + (log(t) * (0.5 - a)))); end
code[x_, y_, z_, t_, a_] := N[(N[Log[z], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] - N[(t + N[(N[Log[t], $MachinePrecision] * N[(0.5 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log z + \left(\log y - \left(t + \log t \cdot \left(0.5 - a\right)\right)\right)
\end{array}
Initial program 99.6%
associate-+l-99.6%
+-commutative99.6%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-def99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in x around 0 70.4%
Final simplification70.4%
(FPCore (x y z t a) :precision binary64 (- (+ (log y) (- (log z) (* (log t) (- 0.5 a)))) t))
double code(double x, double y, double z, double t, double a) {
return (log(y) + (log(z) - (log(t) * (0.5 - a)))) - 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(y) + (log(z) - (log(t) * (0.5d0 - a)))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(y) + (Math.log(z) - (Math.log(t) * (0.5 - a)))) - t;
}
def code(x, y, z, t, a): return (math.log(y) + (math.log(z) - (math.log(t) * (0.5 - a)))) - t
function code(x, y, z, t, a) return Float64(Float64(log(y) + Float64(log(z) - Float64(log(t) * Float64(0.5 - a)))) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(y) + (log(z) - (log(t) * (0.5 - a)))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * N[(0.5 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y + \left(\log z - \log t \cdot \left(0.5 - a\right)\right)\right) - t
\end{array}
Initial program 99.6%
Taylor expanded in x around 0 61.4%
Taylor expanded in x around 0 70.5%
Final simplification70.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.6) (not (<= a 0.49))) (- (* a (log t)) t) (- (+ (* (log t) -0.5) (log (* y z))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.6) || !(a <= 0.49)) {
tmp = (a * log(t)) - t;
} else {
tmp = ((log(t) * -0.5) + log((y * 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 <= (-1.6d0)) .or. (.not. (a <= 0.49d0))) then
tmp = (a * log(t)) - t
else
tmp = ((log(t) * (-0.5d0)) + log((y * 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 <= -1.6) || !(a <= 0.49)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = ((Math.log(t) * -0.5) + Math.log((y * z))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.6) or not (a <= 0.49): tmp = (a * math.log(t)) - t else: tmp = ((math.log(t) * -0.5) + math.log((y * z))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.6) || !(a <= 0.49)) tmp = Float64(Float64(a * log(t)) - t); else tmp = Float64(Float64(Float64(log(t) * -0.5) + log(Float64(y * z))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.6) || ~((a <= 0.49))) tmp = (a * log(t)) - t; else tmp = ((log(t) * -0.5) + log((y * z))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.6], N[Not[LessEqual[a, 0.49]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \lor \neg \left(a \leq 0.49\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log t \cdot -0.5 + \log \left(y \cdot z\right)\right) - t\\
\end{array}
\end{array}
if a < -1.6000000000000001 or 0.48999999999999999 < a Initial program 99.7%
Taylor expanded in x around 0 64.2%
Taylor expanded in a around inf 98.7%
*-commutative98.7%
Simplified98.7%
if -1.6000000000000001 < a < 0.48999999999999999Initial program 99.5%
Taylor expanded in a around 0 97.5%
Taylor expanded in x around 0 65.8%
associate-+r+65.8%
log-prod50.1%
*-commutative50.1%
Simplified50.1%
Final simplification76.1%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.135) (+ (log (* (+ x y) z)) (* (log t) (- a 0.5))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.135) {
tmp = log(((x + y) * z)) + (log(t) * (a - 0.5));
} else {
tmp = (a * log(t)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 0.135d0) then
tmp = log(((x + y) * z)) + (log(t) * (a - 0.5d0))
else
tmp = (a * log(t)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.135) {
tmp = Math.log(((x + y) * z)) + (Math.log(t) * (a - 0.5));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.135: tmp = math.log(((x + y) * z)) + (math.log(t) * (a - 0.5)) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.135) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(log(t) * Float64(a - 0.5))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 0.135) tmp = log(((x + y) * z)) + (log(t) * (a - 0.5)); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.135], N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.135:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 0.13500000000000001Initial program 99.4%
associate-+l-99.4%
+-commutative99.4%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-def99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in t around 0 98.3%
log-prod80.6%
Simplified80.6%
if 0.13500000000000001 < t Initial program 99.9%
Taylor expanded in x around 0 59.2%
Taylor expanded in a around inf 99.0%
*-commutative99.0%
Simplified99.0%
Final simplification89.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.0075) (not (<= a 0.41))) (- (* a (log t)) 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 <= -0.0075) || !(a <= 0.41)) {
tmp = (a * log(t)) - 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 <= (-0.0075d0)) .or. (.not. (a <= 0.41d0))) then
tmp = (a * log(t)) - 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 <= -0.0075) || !(a <= 0.41)) {
tmp = (a * Math.log(t)) - 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 <= -0.0075) or not (a <= 0.41): tmp = (a * math.log(t)) - 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 <= -0.0075) || !(a <= 0.41)) tmp = Float64(Float64(a * log(t)) - 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 <= -0.0075) || ~((a <= 0.41))) tmp = (a * log(t)) - 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, -0.0075], N[Not[LessEqual[a, 0.41]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $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 -0.0075 \lor \neg \left(a \leq 0.41\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot \left(z \cdot {t}^{-0.5}\right)\right) - t\\
\end{array}
\end{array}
if a < -0.0074999999999999997 or 0.409999999999999976 < a Initial program 99.7%
Taylor expanded in x around 0 63.7%
Taylor expanded in a around inf 98.8%
*-commutative98.8%
Simplified98.8%
if -0.0074999999999999997 < a < 0.409999999999999976Initial program 99.5%
Taylor expanded in a around 0 97.5%
associate-+r+97.7%
log-prod77.7%
add-log-exp77.7%
sum-log70.5%
+-commutative70.5%
*-commutative70.5%
exp-to-pow70.6%
Applied egg-rr70.6%
Taylor expanded in y around inf 46.7%
expm1-log1p-u46.7%
expm1-udef28.6%
associate-*l*31.8%
Applied egg-rr31.8%
expm1-def49.1%
expm1-log1p49.1%
Simplified49.1%
Final simplification75.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1450000000.0) (not (<= a 2.2))) (- (* a (log t)) t) (+ (log z) (- (log (+ x y)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1450000000.0) || !(a <= 2.2)) {
tmp = (a * log(t)) - t;
} else {
tmp = log(z) + (log((x + y)) - 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 <= (-1450000000.0d0)) .or. (.not. (a <= 2.2d0))) then
tmp = (a * log(t)) - t
else
tmp = log(z) + (log((x + y)) - 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 <= -1450000000.0) || !(a <= 2.2)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = Math.log(z) + (Math.log((x + y)) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1450000000.0) or not (a <= 2.2): tmp = (a * math.log(t)) - t else: tmp = math.log(z) + (math.log((x + y)) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1450000000.0) || !(a <= 2.2)) tmp = Float64(Float64(a * log(t)) - t); else tmp = Float64(log(z) + Float64(log(Float64(x + y)) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1450000000.0) || ~((a <= 2.2))) tmp = (a * log(t)) - t; else tmp = log(z) + (log((x + y)) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1450000000.0], N[Not[LessEqual[a, 2.2]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1450000000 \lor \neg \left(a \leq 2.2\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\log z + \left(\log \left(x + y\right) - t\right)\\
\end{array}
\end{array}
if a < -1.45e9 or 2.2000000000000002 < a Initial program 99.7%
Taylor expanded in x around 0 63.9%
Taylor expanded in a around inf 98.7%
*-commutative98.7%
Simplified98.7%
if -1.45e9 < a < 2.2000000000000002Initial program 99.5%
associate-+l-99.5%
+-commutative99.5%
associate--l+99.4%
sub-neg99.4%
+-commutative99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
fma-def99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
metadata-eval99.4%
metadata-eval99.4%
unsub-neg99.4%
Simplified99.4%
Taylor expanded in t around inf 59.6%
Final simplification80.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.52e+18) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.52e+18) {
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 <= 1.52d+18) 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 <= 1.52e+18) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.52e+18: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.52e+18) 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 <= 1.52e+18) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.52e+18], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.52 \cdot 10^{+18}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 1.52e18Initial program 99.4%
associate-+l-99.4%
+-commutative99.4%
associate--l+99.3%
sub-neg99.3%
+-commutative99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
fma-def99.3%
sub-neg99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in a around inf 57.8%
*-commutative57.8%
Simplified57.8%
if 1.52e18 < t Initial program 99.9%
associate-+l-99.9%
+-commutative99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 82.3%
neg-mul-182.3%
Simplified82.3%
Final simplification68.6%
(FPCore (x y z t a) :precision binary64 (- (* a (log t)) t))
double code(double x, double y, double z, double t, double a) {
return (a * log(t)) - t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (a * log(t)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (a * Math.log(t)) - t;
}
def code(x, y, z, t, a): return (a * math.log(t)) - t
function code(x, y, z, t, a) return Float64(Float64(a * log(t)) - t) end
function tmp = code(x, y, z, t, a) tmp = (a * log(t)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \log t - t
\end{array}
Initial program 99.6%
Taylor expanded in x around 0 61.4%
Taylor expanded in a around inf 77.0%
*-commutative77.0%
Simplified77.0%
Final simplification77.0%
(FPCore (x y z t a) :precision binary64 (- (/ x y) t))
double code(double x, double y, double z, double t, double a) {
return (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 = (x / y) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (x / y) - t;
}
def code(x, y, z, t, a): return (x / y) - t
function code(x, y, z, t, a) return Float64(Float64(x / y) - t) end
function tmp = code(x, y, z, t, a) tmp = (x / y) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(x / y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} - t
\end{array}
Initial program 99.6%
Taylor expanded in x around 0 61.4%
Taylor expanded in y around 0 27.6%
Final simplification27.6%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.6%
associate-+l-99.6%
+-commutative99.6%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-def99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in t around inf 38.5%
neg-mul-138.5%
Simplified38.5%
Final simplification38.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 2023336
(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))))