
(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.7%
Final simplification99.7%
(FPCore (x y z t a) :precision binary64 (if (<= (log z) 230.0) (- (+ (/ (log t) (/ 1.0 (+ a -0.5))) (log (* y z))) t) (+ (- (log z) t) (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (log(z) <= 230.0) {
tmp = ((log(t) / (1.0 / (a + -0.5))) + log((y * z))) - 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 (log(z) <= 230.0d0) then
tmp = ((log(t) / (1.0d0 / (a + (-0.5d0)))) + log((y * z))) - 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 (Math.log(z) <= 230.0) {
tmp = ((Math.log(t) / (1.0 / (a + -0.5))) + Math.log((y * z))) - t;
} else {
tmp = (Math.log(z) - t) + (a * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.log(z) <= 230.0: tmp = ((math.log(t) / (1.0 / (a + -0.5))) + math.log((y * z))) - t else: tmp = (math.log(z) - t) + (a * math.log(t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (log(z) <= 230.0) tmp = Float64(Float64(Float64(log(t) / Float64(1.0 / Float64(a + -0.5))) + log(Float64(y * z))) - 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 (log(z) <= 230.0) tmp = ((log(t) / (1.0 / (a + -0.5))) + log((y * z))) - t; else tmp = (log(z) - t) + (a * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Log[z], $MachinePrecision], 230.0], N[(N[(N[(N[Log[t], $MachinePrecision] / N[(1.0 / N[(a + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Log[N[(y * z), $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}\;\log z \leq 230:\\
\;\;\;\;\left(\frac{\log t}{\frac{1}{a + -0.5}} + \log \left(y \cdot z\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\end{array}
\end{array}
if (log.f64 z) < 230Initial program 99.6%
sub-neg99.6%
metadata-eval99.6%
flip-+73.6%
associate-*l/73.6%
fma-neg73.6%
metadata-eval73.6%
metadata-eval73.6%
sub-neg73.6%
metadata-eval73.6%
Applied egg-rr73.6%
Taylor expanded in x around 0 47.8%
associate-+r+47.8%
log-prod43.7%
*-commutative43.7%
*-commutative43.7%
unpow243.7%
fma-neg43.7%
metadata-eval43.7%
+-commutative43.7%
associate-*r/43.7%
Simplified43.7%
*-commutative43.7%
associate-/r/43.7%
clear-num43.7%
metadata-eval43.7%
metadata-eval43.7%
fma-neg43.7%
metadata-eval43.7%
metadata-eval43.7%
*-un-lft-identity43.7%
fma-def43.7%
metadata-eval43.7%
fma-neg43.7%
*-un-lft-identity43.7%
flip-+61.4%
Applied egg-rr61.4%
if 230 < (log.f64 z) 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 84.4%
*-commutative84.4%
Simplified84.4%
Final simplification69.2%
(FPCore (x y z t a) :precision binary64 (if (<= (log z) 230.0) (- (+ (* (log t) (+ a -0.5)) (log (* (+ x y) z))) t) (+ (- (log z) t) (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (log(z) <= 230.0) {
tmp = ((log(t) * (a + -0.5)) + log(((x + y) * z))) - 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 (log(z) <= 230.0d0) then
tmp = ((log(t) * (a + (-0.5d0))) + log(((x + y) * z))) - 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 (Math.log(z) <= 230.0) {
tmp = ((Math.log(t) * (a + -0.5)) + Math.log(((x + y) * z))) - t;
} else {
tmp = (Math.log(z) - t) + (a * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if math.log(z) <= 230.0: tmp = ((math.log(t) * (a + -0.5)) + math.log(((x + y) * z))) - t else: tmp = (math.log(z) - t) + (a * math.log(t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (log(z) <= 230.0) tmp = Float64(Float64(Float64(log(t) * Float64(a + -0.5)) + log(Float64(Float64(x + y) * z))) - 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 (log(z) <= 230.0) tmp = ((log(t) * (a + -0.5)) + log(((x + y) * z))) - t; else tmp = (log(z) - t) + (a * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[Log[z], $MachinePrecision], 230.0], N[(N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] + N[Log[N[(N[(x + y), $MachinePrecision] * z), $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}\;\log z \leq 230:\\
\;\;\;\;\left(\log t \cdot \left(a + -0.5\right) + \log \left(\left(x + y\right) \cdot z\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\end{array}
\end{array}
if (log.f64 z) < 230Initial 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%
+-commutative99.5%
fma-udef99.5%
metadata-eval99.5%
sub-neg99.5%
associate-+r+99.6%
associate--l+99.6%
associate-+r-99.6%
sub-neg99.6%
metadata-eval99.6%
sum-log93.9%
Applied egg-rr93.9%
if 230 < (log.f64 z) 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 84.4%
*-commutative84.4%
Simplified84.4%
Final simplification90.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 9.0) (+ (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 <= 9.0) {
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 <= 9.0d0) 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 <= 9.0) {
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 <= 9.0: 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 <= 9.0) 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 <= 9.0) 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, 9.0], N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9:\\
\;\;\;\;\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 < 9Initial program 99.4%
associate--l+99.4%
+-commutative99.4%
associate-+l+99.3%
+-commutative99.3%
fma-def99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in t around 0 98.7%
associate-+r+98.8%
sub-neg98.8%
metadata-eval98.8%
*-commutative98.8%
+-commutative98.8%
log-prod80.3%
+-commutative80.3%
fma-def80.3%
+-commutative80.3%
Simplified80.3%
Taylor expanded in x around 0 50.2%
Taylor expanded in y around 0 63.8%
if 9 < 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 98.3%
*-commutative98.3%
Simplified98.3%
Final simplification80.2%
(FPCore (x y z t a) :precision binary64 (- (+ (log y) (+ (log z) (* (- a 0.5) (log t)))) t))
double code(double x, double y, double z, double t, double a) {
return (log(y) + (log(z) + ((a - 0.5) * 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 = (log(y) + (log(z) + ((a - 0.5d0) * log(t)))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(y) + (Math.log(z) + ((a - 0.5) * Math.log(t)))) - t;
}
def code(x, y, z, t, a): return (math.log(y) + (math.log(z) + ((a - 0.5) * math.log(t)))) - t
function code(x, y, z, t, a) return Float64(Float64(log(y) + Float64(log(z) + Float64(Float64(a - 0.5) * log(t)))) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(y) + (log(z) + ((a - 0.5) * log(t)))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y + \left(\log z + \left(a - 0.5\right) \cdot \log t\right)\right) - t
\end{array}
Initial 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 x around 0 71.3%
Final simplification71.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (* y z)) (* (log t) -0.5)))
(t_2 (* a (log t)))
(t_3 (- t_2 t)))
(if (<= a -2.2e-23)
t_3
(if (<= a -5.3e-216)
t_1
(if (<= a 1.1e-64) (- (fabs t_2) t) (if (<= a 0.23) t_1 t_3))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((y * z)) + (log(t) * -0.5);
double t_2 = a * log(t);
double t_3 = t_2 - t;
double tmp;
if (a <= -2.2e-23) {
tmp = t_3;
} else if (a <= -5.3e-216) {
tmp = t_1;
} else if (a <= 1.1e-64) {
tmp = fabs(t_2) - t;
} else if (a <= 0.23) {
tmp = t_1;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = log((y * z)) + (log(t) * (-0.5d0))
t_2 = a * log(t)
t_3 = t_2 - t
if (a <= (-2.2d-23)) then
tmp = t_3
else if (a <= (-5.3d-216)) then
tmp = t_1
else if (a <= 1.1d-64) then
tmp = abs(t_2) - t
else if (a <= 0.23d0) then
tmp = t_1
else
tmp = t_3
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 t_2 = a * Math.log(t);
double t_3 = t_2 - t;
double tmp;
if (a <= -2.2e-23) {
tmp = t_3;
} else if (a <= -5.3e-216) {
tmp = t_1;
} else if (a <= 1.1e-64) {
tmp = Math.abs(t_2) - t;
} else if (a <= 0.23) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((y * z)) + (math.log(t) * -0.5) t_2 = a * math.log(t) t_3 = t_2 - t tmp = 0 if a <= -2.2e-23: tmp = t_3 elif a <= -5.3e-216: tmp = t_1 elif a <= 1.1e-64: tmp = math.fabs(t_2) - t elif a <= 0.23: tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t, a) t_1 = Float64(log(Float64(y * z)) + Float64(log(t) * -0.5)) t_2 = Float64(a * log(t)) t_3 = Float64(t_2 - t) tmp = 0.0 if (a <= -2.2e-23) tmp = t_3; elseif (a <= -5.3e-216) tmp = t_1; elseif (a <= 1.1e-64) tmp = Float64(abs(t_2) - t); elseif (a <= 0.23) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((y * z)) + (log(t) * -0.5); t_2 = a * log(t); t_3 = t_2 - t; tmp = 0.0; if (a <= -2.2e-23) tmp = t_3; elseif (a <= -5.3e-216) tmp = t_1; elseif (a <= 1.1e-64) tmp = abs(t_2) - t; elseif (a <= 0.23) tmp = t_1; else tmp = t_3; 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]}, Block[{t$95$2 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - t), $MachinePrecision]}, If[LessEqual[a, -2.2e-23], t$95$3, If[LessEqual[a, -5.3e-216], t$95$1, If[LessEqual[a, 1.1e-64], N[(N[Abs[t$95$2], $MachinePrecision] - t), $MachinePrecision], If[LessEqual[a, 0.23], t$95$1, t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(y \cdot z\right) + \log t \cdot -0.5\\
t_2 := a \cdot \log t\\
t_3 := t_2 - t\\
\mathbf{if}\;a \leq -2.2 \cdot 10^{-23}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;a \leq -5.3 \cdot 10^{-216}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{-64}:\\
\;\;\;\;\left|t_2\right| - t\\
\mathbf{elif}\;a \leq 0.23:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if a < -2.1999999999999999e-23 or 0.23000000000000001 < a 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 x around 0 80.7%
Taylor expanded in a around inf 98.3%
*-commutative98.3%
Simplified98.3%
if -2.1999999999999999e-23 < a < -5.29999999999999977e-216 or 1.1e-64 < a < 0.23000000000000001Initial program 99.3%
associate--l+99.3%
+-commutative99.3%
associate-+l+98.8%
+-commutative98.8%
fma-def98.8%
sub-neg98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in t around 0 77.5%
associate-+r+78.0%
sub-neg78.0%
metadata-eval78.0%
*-commutative78.0%
+-commutative78.0%
log-prod68.8%
+-commutative68.8%
fma-def68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in x around 0 26.4%
Taylor expanded in a around 0 26.4%
*-commutative26.4%
Simplified26.4%
if -5.29999999999999977e-216 < a < 1.1e-64Initial program 99.5%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.6%
+-commutative99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 63.7%
Taylor expanded in a around inf 59.3%
*-commutative59.3%
Simplified59.3%
add-sqr-sqrt38.3%
sqrt-unprod59.4%
pow259.4%
*-commutative59.4%
Applied egg-rr59.4%
unpow259.4%
rem-sqrt-square59.5%
*-commutative59.5%
Simplified59.5%
Final simplification78.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.4e-18) (not (<= a 2.6e-8))) (+ (- (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 <= -5.4e-18) || !(a <= 2.6e-8)) {
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 <= (-5.4d-18)) .or. (.not. (a <= 2.6d-8))) 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 <= -5.4e-18) || !(a <= 2.6e-8)) {
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 <= -5.4e-18) or not (a <= 2.6e-8): 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 <= -5.4e-18) || !(a <= 2.6e-8)) tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); else tmp = Float64(log(Float64(Float64(y * z) * (t ^ -0.5))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -5.4e-18) || ~((a <= 2.6e-8))) 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, -5.4e-18], N[Not[LessEqual[a, 2.6e-8]], $MachinePrecision]], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(N[(y * z), $MachinePrecision] * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{-18} \lor \neg \left(a \leq 2.6 \cdot 10^{-8}\right):\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\log \left(\left(y \cdot z\right) \cdot {t}^{-0.5}\right) - t\\
\end{array}
\end{array}
if a < -5.39999999999999977e-18 or 2.6000000000000001e-8 < a 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 97.3%
*-commutative97.3%
Simplified97.3%
if -5.39999999999999977e-18 < a < 2.6000000000000001e-8Initial program 99.4%
associate--l+99.4%
+-commutative99.4%
associate-+l+99.2%
+-commutative99.2%
fma-def99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around 0 56.9%
Taylor expanded in a around 0 56.9%
associate-+r+56.9%
log-prod45.3%
*-commutative45.3%
*-commutative45.3%
Simplified45.3%
add-log-exp45.3%
sum-log41.3%
exp-to-pow41.3%
Applied egg-rr41.3%
Final simplification76.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 6.8e-11) (+ (* (- a 0.5) (log t)) (log (* y z))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 6.8e-11) {
tmp = ((a - 0.5) * log(t)) + log((y * z));
} 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 <= 6.8d-11) then
tmp = ((a - 0.5d0) * log(t)) + log((y * z))
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 <= 6.8e-11) {
tmp = ((a - 0.5) * Math.log(t)) + Math.log((y * z));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 6.8e-11: tmp = ((a - 0.5) * math.log(t)) + math.log((y * z)) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 6.8e-11) tmp = Float64(Float64(Float64(a - 0.5) * log(t)) + log(Float64(y * z))); 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 <= 6.8e-11) tmp = ((a - 0.5) * log(t)) + log((y * z)); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 6.8e-11], N[(N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 6.8 \cdot 10^{-11}:\\
\;\;\;\;\left(a - 0.5\right) \cdot \log t + \log \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 6.7999999999999998e-11Initial program 99.4%
associate--l+99.4%
+-commutative99.4%
associate-+l+99.3%
+-commutative99.3%
fma-def99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in t around 0 99.3%
associate-+r+99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
+-commutative99.4%
log-prod81.5%
+-commutative81.5%
fma-def81.5%
+-commutative81.5%
Simplified81.5%
Taylor expanded in x around 0 50.6%
if 6.7999999999999998e-11 < 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 x around 0 78.6%
Taylor expanded in a around inf 96.9%
*-commutative96.9%
Simplified96.9%
Final simplification73.6%
(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.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 80.0%
*-commutative80.0%
Simplified80.0%
Final simplification80.0%
(FPCore (x y z t a) :precision binary64 (- (* a (log t)) t))
double code(double x, double y, double z, double t, double a) {
return (a * log(t)) - t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (a * log(t)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (a * Math.log(t)) - t;
}
def code(x, y, z, t, a): return (a * math.log(t)) - t
function code(x, y, z, t, a) return Float64(Float64(a * log(t)) - t) end
function tmp = code(x, y, z, t, a) tmp = (a * log(t)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \log t - t
\end{array}
Initial program 99.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 x around 0 71.3%
Taylor expanded in a around inf 78.3%
*-commutative78.3%
Simplified78.3%
Final simplification78.3%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.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 t around inf 36.1%
neg-mul-136.1%
Simplified36.1%
Final simplification36.1%
(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 2023333
(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))))