
(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 14 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) (fma (log t) (- 0.5 a) t))))
double code(double x, double y, double z, double t, double a) {
return log((x + y)) + (log(z) - fma(log(t), (0.5 - a), t));
}
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + Float64(log(z) - fma(log(t), Float64(0.5 - a), t))) end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * N[(0.5 - a), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, 0.5 - a, t\right)\right)
\end{array}
Initial program 99.5%
associate-+l-99.5%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ x y)) (log z))))
(if (or (<= t_1 -700.0) (not (<= t_1 720.0)))
(- (* (log t) (+ a -0.5)) t)
(- (+ (log (* (+ x y) z)) (* (log t) (- a 0.5))) t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y)) + log(z);
double tmp;
if ((t_1 <= -700.0) || !(t_1 <= 720.0)) {
tmp = (log(t) * (a + -0.5)) - t;
} else {
tmp = (log(((x + y) * z)) + (log(t) * (a - 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) :: t_1
real(8) :: tmp
t_1 = log((x + y)) + log(z)
if ((t_1 <= (-700.0d0)) .or. (.not. (t_1 <= 720.0d0))) then
tmp = (log(t) * (a + (-0.5d0))) - t
else
tmp = (log(((x + y) * z)) + (log(t) * (a - 0.5d0))) - 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((x + y)) + Math.log(z);
double tmp;
if ((t_1 <= -700.0) || !(t_1 <= 720.0)) {
tmp = (Math.log(t) * (a + -0.5)) - t;
} else {
tmp = (Math.log(((x + y) * z)) + (Math.log(t) * (a - 0.5))) - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((x + y)) + math.log(z) tmp = 0 if (t_1 <= -700.0) or not (t_1 <= 720.0): tmp = (math.log(t) * (a + -0.5)) - t else: tmp = (math.log(((x + y) * z)) + (math.log(t) * (a - 0.5))) - t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(Float64(x + y)) + log(z)) tmp = 0.0 if ((t_1 <= -700.0) || !(t_1 <= 720.0)) tmp = Float64(Float64(log(t) * Float64(a + -0.5)) - t); else tmp = Float64(Float64(log(Float64(Float64(x + y) * z)) + Float64(log(t) * Float64(a - 0.5))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((x + y)) + log(z); tmp = 0.0; if ((t_1 <= -700.0) || ~((t_1 <= 720.0))) tmp = (log(t) * (a + -0.5)) - t; else tmp = (log(((x + y) * z)) + (log(t) * (a - 0.5))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -700.0], N[Not[LessEqual[t$95$1, 720.0]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
\mathbf{if}\;t\_1 \leq -700 \lor \neg \left(t\_1 \leq 720\right):\\
\;\;\;\;\log t \cdot \left(a + -0.5\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(\left(x + y\right) \cdot z\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -700 or 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 99.9%
Taylor expanded in t around inf 80.8%
neg-mul-180.8%
Simplified80.8%
if -700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial program 99.4%
associate-+l-99.4%
associate--l+99.4%
sub-neg99.4%
+-commutative99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
fma-undefine99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
metadata-eval99.4%
metadata-eval99.4%
unsub-neg99.4%
Simplified99.4%
associate-+r-99.4%
fma-undefine99.4%
associate--r+99.4%
sum-log99.6%
Applied egg-rr99.6%
Final simplification94.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (log t) (+ a -0.5))) (t_2 (+ (log (+ x y)) (log z))))
(if (or (<= t_2 -700.0) (not (<= t_2 720.0)))
(- t_1 t)
(- (log (* y z)) (- t t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * (a + -0.5);
double t_2 = log((x + y)) + log(z);
double tmp;
if ((t_2 <= -700.0) || !(t_2 <= 720.0)) {
tmp = t_1 - t;
} else {
tmp = log((y * z)) - (t - t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = log(t) * (a + (-0.5d0))
t_2 = log((x + y)) + log(z)
if ((t_2 <= (-700.0d0)) .or. (.not. (t_2 <= 720.0d0))) then
tmp = t_1 - t
else
tmp = log((y * z)) - (t - t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = Math.log(t) * (a + -0.5);
double t_2 = Math.log((x + y)) + Math.log(z);
double tmp;
if ((t_2 <= -700.0) || !(t_2 <= 720.0)) {
tmp = t_1 - t;
} else {
tmp = Math.log((y * z)) - (t - t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(t) * (a + -0.5) t_2 = math.log((x + y)) + math.log(z) tmp = 0 if (t_2 <= -700.0) or not (t_2 <= 720.0): tmp = t_1 - t else: tmp = math.log((y * z)) - (t - t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(log(t) * Float64(a + -0.5)) t_2 = Float64(log(Float64(x + y)) + log(z)) tmp = 0.0 if ((t_2 <= -700.0) || !(t_2 <= 720.0)) tmp = Float64(t_1 - t); else tmp = Float64(log(Float64(y * z)) - Float64(t - t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(t) * (a + -0.5); t_2 = log((x + y)) + log(z); tmp = 0.0; if ((t_2 <= -700.0) || ~((t_2 <= 720.0))) tmp = t_1 - t; else tmp = log((y * z)) - (t - t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -700.0], N[Not[LessEqual[t$95$2, 720.0]], $MachinePrecision]], N[(t$95$1 - t), $MachinePrecision], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] - N[(t - t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot \left(a + -0.5\right)\\
t_2 := \log \left(x + y\right) + \log z\\
\mathbf{if}\;t\_2 \leq -700 \lor \neg \left(t\_2 \leq 720\right):\\
\;\;\;\;t\_1 - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot z\right) - \left(t - t\_1\right)\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -700 or 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 99.9%
Taylor expanded in t around inf 80.8%
neg-mul-180.8%
Simplified80.8%
if -700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial program 99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
associate--l+99.4%
Simplified99.4%
associate-+r-99.4%
sum-log99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 67.1%
associate--l+67.1%
sub-neg67.1%
metadata-eval67.1%
+-commutative67.1%
Simplified67.1%
Final simplification70.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (log t) (+ a -0.5)))) (if (<= t 480.0) (+ t_1 (+ (log (+ x y)) (log z))) (- t_1 t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * (a + -0.5);
double tmp;
if (t <= 480.0) {
tmp = t_1 + (log((x + y)) + log(z));
} else {
tmp = t_1 - 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(t) * (a + (-0.5d0))
if (t <= 480.0d0) then
tmp = t_1 + (log((x + y)) + log(z))
else
tmp = t_1 - 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(t) * (a + -0.5);
double tmp;
if (t <= 480.0) {
tmp = t_1 + (Math.log((x + y)) + Math.log(z));
} else {
tmp = t_1 - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(t) * (a + -0.5) tmp = 0 if t <= 480.0: tmp = t_1 + (math.log((x + y)) + math.log(z)) else: tmp = t_1 - t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(t) * Float64(a + -0.5)) tmp = 0.0 if (t <= 480.0) tmp = Float64(t_1 + Float64(log(Float64(x + y)) + log(z))); else tmp = Float64(t_1 - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(t) * (a + -0.5); tmp = 0.0; if (t <= 480.0) tmp = t_1 + (log((x + y)) + log(z)); else tmp = t_1 - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 480.0], N[(t$95$1 + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot \left(a + -0.5\right)\\
\mathbf{if}\;t \leq 480:\\
\;\;\;\;t\_1 + \left(\log \left(x + y\right) + \log z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t\\
\end{array}
\end{array}
if t < 480Initial program 99.2%
associate--l+99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in t around inf 95.3%
Taylor expanded in t around 0 98.4%
+-commutative98.4%
Simplified98.4%
if 480 < t Initial program 99.8%
associate--l+99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 99.9%
Taylor expanded in t around inf 98.4%
neg-mul-198.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 205.0) (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) (- (* (log t) (+ a -0.5)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 205.0) {
tmp = log(y) + (log(z) + (log(t) * (a - 0.5)));
} else {
tmp = (log(t) * (a + -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 (t <= 205.0d0) then
tmp = log(y) + (log(z) + (log(t) * (a - 0.5d0)))
else
tmp = (log(t) * (a + (-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 (t <= 205.0) {
tmp = Math.log(y) + (Math.log(z) + (Math.log(t) * (a - 0.5)));
} else {
tmp = (Math.log(t) * (a + -0.5)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 205.0: tmp = math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5))) else: tmp = (math.log(t) * (a + -0.5)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 205.0) tmp = Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))); else tmp = Float64(Float64(log(t) * Float64(a + -0.5)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 205.0) tmp = log(y) + (log(z) + (log(t) * (a - 0.5))); else tmp = (log(t) * (a + -0.5)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 205.0], N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 205:\\
\;\;\;\;\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log t \cdot \left(a + -0.5\right) - t\\
\end{array}
\end{array}
if t < 205Initial program 99.2%
associate--l+99.2%
+-commutative99.2%
associate-+l+99.2%
+-commutative99.2%
fma-define99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around 0 59.8%
Taylor expanded in t around 0 59.0%
if 205 < t Initial program 99.8%
associate--l+99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 99.9%
Taylor expanded in t around inf 98.4%
neg-mul-198.4%
Simplified98.4%
Final simplification79.2%
(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(log(Float64(x + y)) + Float64(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[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \log t \cdot \left(a + -0.5\right)
\end{array}
Initial program 99.5%
associate--l+99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t a) :precision binary64 (- (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) t))
double code(double x, double y, double z, double t, double a) {
return (log(y) + (log(z) + (log(t) * (a - 0.5)))) - 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) * (a - 0.5d0)))) - 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) * (a - 0.5)))) - t;
}
def code(x, y, z, t, a): return (math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5)))) - t
function code(x, y, z, t, a) return Float64(Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(y) + (log(z) + (log(t) * (a - 0.5)))) - 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[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t
\end{array}
Initial program 99.5%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.5%
+-commutative99.5%
fma-define99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 68.5%
(FPCore (x y z t a) :precision binary64 (+ (- (log z) t) (+ (log y) (* (log t) (- a 0.5)))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + (log(y) + (log(t) * (a - 0.5)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (log(z) - t) + (log(y) + (log(t) * (a - 0.5d0)))
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(z) - t) + (Math.log(y) + (Math.log(t) * (a - 0.5)));
}
def code(x, y, z, t, a): return (math.log(z) - t) + (math.log(y) + (math.log(t) * (a - 0.5)))
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + Float64(log(y) + Float64(log(t) * Float64(a - 0.5)))) end
function tmp = code(x, y, z, t, a) tmp = (log(z) - t) + (log(y) + (log(t) * (a - 0.5))); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \left(\log y + \log t \cdot \left(a - 0.5\right)\right)
\end{array}
Initial program 99.5%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.5%
+-commutative99.5%
fma-define99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 68.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.000235) (not (<= a 4.4e-65))) (- (* (log t) (+ a -0.5)) 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.000235) || !(a <= 4.4e-65)) {
tmp = (log(t) * (a + -0.5)) - 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.000235d0)) .or. (.not. (a <= 4.4d-65))) then
tmp = (log(t) * (a + (-0.5d0))) - 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.000235) || !(a <= 4.4e-65)) {
tmp = (Math.log(t) * (a + -0.5)) - 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.000235) or not (a <= 4.4e-65): tmp = (math.log(t) * (a + -0.5)) - 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.000235) || !(a <= 4.4e-65)) tmp = Float64(Float64(log(t) * Float64(a + -0.5)) - 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 <= -0.000235) || ~((a <= 4.4e-65))) tmp = (log(t) * (a + -0.5)) - 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.000235], N[Not[LessEqual[a, 4.4e-65]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] - t), $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 -0.000235 \lor \neg \left(a \leq 4.4 \cdot 10^{-65}\right):\\
\;\;\;\;\log t \cdot \left(a + -0.5\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(\left(y \cdot z\right) \cdot {t}^{-0.5}\right) - t\\
\end{array}
\end{array}
if a < -2.34999999999999993e-4 or 4.40000000000000042e-65 < a Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in t around inf 98.3%
Taylor expanded in t around inf 94.7%
neg-mul-194.7%
Simplified94.7%
if -2.34999999999999993e-4 < a < 4.40000000000000042e-65Initial program 99.3%
+-commutative99.3%
fma-define99.3%
sub-neg99.3%
metadata-eval99.3%
associate--l+99.3%
Simplified99.3%
associate-+r-99.3%
sum-log75.9%
Applied egg-rr75.9%
Taylor expanded in x around 0 50.9%
Taylor expanded in a around 0 49.7%
associate--l+49.7%
Simplified49.7%
associate-+r-49.7%
add-log-exp49.7%
sum-log45.6%
*-commutative45.6%
*-commutative45.6%
exp-to-pow45.7%
Applied egg-rr45.7%
Final simplification72.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.00023) (+ (log (* y z)) (* (log t) (- a 0.5))) (- (* (log t) (+ a -0.5)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.00023) {
tmp = log((y * z)) + (log(t) * (a - 0.5));
} else {
tmp = (log(t) * (a + -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 (t <= 0.00023d0) then
tmp = log((y * z)) + (log(t) * (a - 0.5d0))
else
tmp = (log(t) * (a + (-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 (t <= 0.00023) {
tmp = Math.log((y * z)) + (Math.log(t) * (a - 0.5));
} else {
tmp = (Math.log(t) * (a + -0.5)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.00023: tmp = math.log((y * z)) + (math.log(t) * (a - 0.5)) else: tmp = (math.log(t) * (a + -0.5)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.00023) tmp = Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5))); else tmp = Float64(Float64(log(t) * Float64(a + -0.5)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 0.00023) tmp = log((y * z)) + (log(t) * (a - 0.5)); else tmp = (log(t) * (a + -0.5)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.00023], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.00023:\\
\;\;\;\;\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\log t \cdot \left(a + -0.5\right) - t\\
\end{array}
\end{array}
if t < 2.3000000000000001e-4Initial program 99.2%
+-commutative99.2%
fma-define99.2%
sub-neg99.2%
metadata-eval99.2%
associate--l+99.2%
Simplified99.2%
associate-+r-99.2%
sum-log76.4%
Applied egg-rr76.4%
Taylor expanded in x around 0 46.6%
Taylor expanded in t around 0 46.2%
if 2.3000000000000001e-4 < t Initial program 99.8%
associate--l+99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 99.9%
Taylor expanded in t around inf 98.4%
neg-mul-198.4%
Simplified98.4%
Final simplification72.9%
(FPCore (x y z t a) :precision binary64 (if (<= t 8.5e+21) (* (log t) a) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 8.5e+21) {
tmp = log(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 <= 8.5d+21) then
tmp = log(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 <= 8.5e+21) {
tmp = Math.log(t) * a;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 8.5e+21: tmp = math.log(t) * a else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 8.5e+21) tmp = Float64(log(t) * a); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 8.5e+21) tmp = log(t) * a; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 8.5e+21], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8.5 \cdot 10^{+21}:\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 8.5e21Initial program 99.2%
associate-+l-99.2%
associate--l+99.3%
sub-neg99.3%
+-commutative99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
fma-undefine99.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 54.2%
*-commutative54.2%
Simplified54.2%
if 8.5e21 < t Initial program 99.9%
associate-+l-99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-undefine99.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 79.5%
neg-mul-179.5%
Simplified79.5%
(FPCore (x y z t a) :precision binary64 (- (* (log t) (+ a -0.5)) t))
double code(double x, double y, double z, double t, double a) {
return (log(t) * (a + -0.5)) - 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(t) * (a + (-0.5d0))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(t) * (a + -0.5)) - t;
}
def code(x, y, z, t, a): return (math.log(t) * (a + -0.5)) - t
function code(x, y, z, t, a) return Float64(Float64(log(t) * Float64(a + -0.5)) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(t) * (a + -0.5)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[t], $MachinePrecision] * N[(a + -0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log t \cdot \left(a + -0.5\right) - t
\end{array}
Initial program 99.5%
associate--l+99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in t around inf 97.6%
Taylor expanded in t around inf 79.1%
neg-mul-179.1%
Simplified79.1%
Final simplification79.1%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.5%
associate-+l-99.5%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.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 40.7%
neg-mul-140.7%
Simplified40.7%
(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 t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 99.5%
associate-+l-99.5%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.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 40.7%
neg-mul-140.7%
Simplified40.7%
add-sqr-sqrt0.0%
sqrt-unprod2.3%
sqr-neg2.3%
sqrt-unprod2.4%
add-sqr-sqrt2.4%
*-un-lft-identity2.4%
Applied egg-rr2.4%
*-lft-identity2.4%
Simplified2.4%
(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 2024139
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (+ (log (+ x y)) (+ (- (log z) t) (* (- a 1/2) (log t)))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))