
(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 13 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 z) t) (fma (+ a -0.5) (log t) (log (+ x y)))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + fma((a + -0.5), log(t), log((x + y)));
}
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + fma(Float64(a + -0.5), log(t), log(Float64(x + y)))) end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \mathsf{fma}\left(a + -0.5, \log t, \log \left(x + y\right)\right)
\end{array}
Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (log z) t)) (t_2 (+ (log z) (log (+ x y)))))
(if (<= t_2 -750.0)
(+ t_1 (* a (log t)))
(if (<= t_2 700.0)
(- (+ (log (* z (+ x y))) (* (log t) (- a 0.5))) t)
(fma (log t) a t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(z) - t;
double t_2 = log(z) + log((x + y));
double tmp;
if (t_2 <= -750.0) {
tmp = t_1 + (a * log(t));
} else if (t_2 <= 700.0) {
tmp = (log((z * (x + y))) + (log(t) * (a - 0.5))) - t;
} else {
tmp = fma(log(t), a, t_1);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(z) - t) t_2 = Float64(log(z) + log(Float64(x + y))) tmp = 0.0 if (t_2 <= -750.0) tmp = Float64(t_1 + Float64(a * log(t))); elseif (t_2 <= 700.0) tmp = Float64(Float64(log(Float64(z * Float64(x + y))) + Float64(log(t) * Float64(a - 0.5))) - t); else tmp = fma(log(t), a, t_1); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[z], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -750.0], N[(t$95$1 + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 700.0], N[(N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * a + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log z - t\\
t_2 := \log z + \log \left(x + y\right)\\
\mathbf{if}\;t\_2 \leq -750:\\
\;\;\;\;t\_1 + a \cdot \log t\\
\mathbf{elif}\;t\_2 \leq 700:\\
\;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, t\_1\right)\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -750Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 68.2%
Taylor expanded in a around inf 73.1%
*-commutative73.1%
Simplified73.1%
if -750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700Initial program 99.7%
associate-+l-99.7%
associate--l+99.7%
sub-neg99.7%
+-commutative99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-undefine99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
metadata-eval99.7%
metadata-eval99.7%
unsub-neg99.7%
Simplified99.7%
associate-+r-99.7%
fma-undefine99.7%
associate--r+99.7%
sum-log99.7%
Applied egg-rr99.7%
if 700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 70.4%
Taylor expanded in a around inf 73.1%
*-commutative73.1%
Simplified73.1%
+-commutative73.1%
fma-define73.1%
Applied egg-rr73.1%
Final simplification92.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log z) (log (+ x y)))))
(if (or (<= t_1 -750.0) (not (<= t_1 700.0)))
(+ (- (log z) t) (* a (log t)))
(- (+ (log (* z (+ x y))) (* (log t) (- a 0.5))) t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(z) + log((x + y));
double tmp;
if ((t_1 <= -750.0) || !(t_1 <= 700.0)) {
tmp = (log(z) - t) + (a * log(t));
} else {
tmp = (log((z * (x + y))) + (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(z) + log((x + y))
if ((t_1 <= (-750.0d0)) .or. (.not. (t_1 <= 700.0d0))) then
tmp = (log(z) - t) + (a * log(t))
else
tmp = (log((z * (x + y))) + (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(z) + Math.log((x + y));
double tmp;
if ((t_1 <= -750.0) || !(t_1 <= 700.0)) {
tmp = (Math.log(z) - t) + (a * Math.log(t));
} else {
tmp = (Math.log((z * (x + y))) + (Math.log(t) * (a - 0.5))) - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(z) + math.log((x + y)) tmp = 0 if (t_1 <= -750.0) or not (t_1 <= 700.0): tmp = (math.log(z) - t) + (a * math.log(t)) else: tmp = (math.log((z * (x + y))) + (math.log(t) * (a - 0.5))) - t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(z) + log(Float64(x + y))) tmp = 0.0 if ((t_1 <= -750.0) || !(t_1 <= 700.0)) tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); else tmp = Float64(Float64(log(Float64(z * Float64(x + y))) + Float64(log(t) * Float64(a - 0.5))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(z) + log((x + y)); tmp = 0.0; if ((t_1 <= -750.0) || ~((t_1 <= 700.0))) tmp = (log(z) - t) + (a * log(t)); else tmp = (log((z * (x + y))) + (log(t) * (a - 0.5))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[z], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -750.0], N[Not[LessEqual[t$95$1, 700.0]], $MachinePrecision]], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $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 z + \log \left(x + y\right)\\
\mathbf{if}\;t\_1 \leq -750 \lor \neg \left(t\_1 \leq 700\right):\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\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)) < -750 or 700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 70.1%
Taylor expanded in a around inf 73.1%
*-commutative73.1%
Simplified73.1%
if -750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700Initial program 99.7%
associate-+l-99.7%
associate--l+99.7%
sub-neg99.7%
+-commutative99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-undefine99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
metadata-eval99.7%
metadata-eval99.7%
unsub-neg99.7%
Simplified99.7%
associate-+r-99.7%
fma-undefine99.7%
associate--r+99.7%
sum-log99.7%
Applied egg-rr99.7%
Final simplification92.3%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.8e-5) (+ (log z) (+ (log y) (* (log t) (- a 0.5)))) (fma (log t) a (- (log z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.8e-5) {
tmp = log(z) + (log(y) + (log(t) * (a - 0.5)));
} else {
tmp = fma(log(t), a, (log(z) - t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.8e-5) tmp = Float64(log(z) + Float64(log(y) + Float64(log(t) * Float64(a - 0.5)))); else tmp = fma(log(t), a, Float64(log(z) - t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.8e-5], N[(N[Log[z], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * a + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.8 \cdot 10^{-5}:\\
\;\;\;\;\log z + \left(\log y + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a, \log z - t\right)\\
\end{array}
\end{array}
if t < 1.80000000000000005e-5Initial 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 66.1%
Taylor expanded in t around 0 66.0%
if 1.80000000000000005e-5 < t Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 64.8%
Taylor expanded in a around inf 98.9%
*-commutative98.9%
Simplified98.9%
+-commutative98.9%
fma-define98.9%
Applied egg-rr98.9%
Final simplification81.0%
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log z) (log (+ x y))) t) (* (log t) (- a 0.5))))
double code(double x, double y, double z, double t, double a) {
return ((log(z) + log((x + y))) - 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(z) + log((x + y))) - 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(z) + Math.log((x + y))) - t) + (Math.log(t) * (a - 0.5));
}
def code(x, y, z, t, a): return ((math.log(z) + math.log((x + y))) - t) + (math.log(t) * (a - 0.5))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(z) + log(Float64(x + y))) - t) + Float64(log(t) * Float64(a - 0.5))) end
function tmp = code(x, y, z, t, a) tmp = ((log(z) + log((x + y))) - t) + (log(t) * (a - 0.5)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[z], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log z + \log \left(x + y\right)\right) - t\right) + \log t \cdot \left(a - 0.5\right)
\end{array}
Initial program 99.7%
Final simplification99.7%
(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.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 65.5%
Final simplification65.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.75e-248) (not (<= a 1.4e-116))) (+ (- (log z) t) (* a (log t))) (log (* z (* (+ x y) (pow t (+ a -0.5)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.75e-248) || !(a <= 1.4e-116)) {
tmp = (log(z) - t) + (a * log(t));
} else {
tmp = log((z * ((x + y) * pow(t, (a + -0.5)))));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-2.75d-248)) .or. (.not. (a <= 1.4d-116))) then
tmp = (log(z) - t) + (a * log(t))
else
tmp = log((z * ((x + y) * (t ** (a + (-0.5d0))))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.75e-248) || !(a <= 1.4e-116)) {
tmp = (Math.log(z) - t) + (a * Math.log(t));
} else {
tmp = Math.log((z * ((x + y) * Math.pow(t, (a + -0.5)))));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.75e-248) or not (a <= 1.4e-116): tmp = (math.log(z) - t) + (a * math.log(t)) else: tmp = math.log((z * ((x + y) * math.pow(t, (a + -0.5))))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.75e-248) || !(a <= 1.4e-116)) tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); else tmp = log(Float64(z * Float64(Float64(x + y) * (t ^ Float64(a + -0.5))))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2.75e-248) || ~((a <= 1.4e-116))) tmp = (log(z) - t) + (a * log(t)); else tmp = log((z * ((x + y) * (t ^ (a + -0.5))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.75e-248], N[Not[LessEqual[a, 1.4e-116]], $MachinePrecision]], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[(z * N[(N[(x + y), $MachinePrecision] * N[Power[t, N[(a + -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.75 \cdot 10^{-248} \lor \neg \left(a \leq 1.4 \cdot 10^{-116}\right):\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\log \left(z \cdot \left(\left(x + y\right) \cdot {t}^{\left(a + -0.5\right)}\right)\right)\\
\end{array}
\end{array}
if a < -2.74999999999999989e-248 or 1.3999999999999999e-116 < a Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 67.8%
Taylor expanded in a around inf 84.3%
*-commutative84.3%
Simplified84.3%
if -2.74999999999999989e-248 < a < 1.3999999999999999e-116Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.5%
+-commutative99.5%
fma-define99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in t around 0 78.0%
add-log-exp72.4%
sum-log51.6%
fma-undefine51.6%
*-commutative51.6%
metadata-eval51.6%
sub-neg51.6%
exp-sum51.7%
add-exp-log51.7%
sub-neg51.7%
metadata-eval51.7%
exp-to-pow51.9%
+-commutative51.9%
Applied egg-rr51.9%
Final simplification77.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.2e-237) (not (<= a 5.8e-111))) (+ (- (log z) t) (* a (log t))) (log (* (+ x y) (* z (pow t (+ a -0.5)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.2e-237) || !(a <= 5.8e-111)) {
tmp = (log(z) - t) + (a * log(t));
} else {
tmp = log(((x + y) * (z * pow(t, (a + -0.5)))));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-1.2d-237)) .or. (.not. (a <= 5.8d-111))) then
tmp = (log(z) - t) + (a * log(t))
else
tmp = log(((x + y) * (z * (t ** (a + (-0.5d0))))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.2e-237) || !(a <= 5.8e-111)) {
tmp = (Math.log(z) - t) + (a * Math.log(t));
} else {
tmp = Math.log(((x + y) * (z * Math.pow(t, (a + -0.5)))));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.2e-237) or not (a <= 5.8e-111): tmp = (math.log(z) - t) + (a * math.log(t)) else: tmp = math.log(((x + y) * (z * math.pow(t, (a + -0.5))))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.2e-237) || !(a <= 5.8e-111)) tmp = Float64(Float64(log(z) - t) + Float64(a * log(t))); else tmp = log(Float64(Float64(x + y) * Float64(z * (t ^ Float64(a + -0.5))))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.2e-237) || ~((a <= 5.8e-111))) tmp = (log(z) - t) + (a * log(t)); else tmp = log(((x + y) * (z * (t ^ (a + -0.5))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.2e-237], N[Not[LessEqual[a, 5.8e-111]], $MachinePrecision]], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[(N[(x + y), $MachinePrecision] * N[(z * N[Power[t, N[(a + -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.2 \cdot 10^{-237} \lor \neg \left(a \leq 5.8 \cdot 10^{-111}\right):\\
\;\;\;\;\left(\log z - t\right) + a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot \left(z \cdot {t}^{\left(a + -0.5\right)}\right)\right)\\
\end{array}
\end{array}
if a < -1.2e-237 or 5.80000000000000003e-111 < a Initial program 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 67.8%
Taylor expanded in a around inf 84.3%
*-commutative84.3%
Simplified84.3%
if -1.2e-237 < a < 5.80000000000000003e-111Initial program 99.6%
associate--l+99.6%
+-commutative99.6%
associate-+l+99.5%
+-commutative99.5%
fma-define99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in t around 0 78.0%
*-un-lft-identity78.0%
add-log-exp72.4%
sum-log51.6%
fma-undefine51.6%
*-commutative51.6%
metadata-eval51.6%
sub-neg51.6%
exp-sum51.7%
add-exp-log51.7%
sub-neg51.7%
metadata-eval51.7%
exp-to-pow51.9%
+-commutative51.9%
Applied egg-rr51.9%
*-lft-identity51.9%
associate-*r*53.8%
Simplified53.8%
Final simplification78.2%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.5e+15) (* a (log t)) (+ (- (log z) t) (log (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.5e+15) {
tmp = a * log(t);
} else {
tmp = (log(z) - t) + log((x + y));
}
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.5d+15) then
tmp = a * log(t)
else
tmp = (log(z) - t) + log((x + y))
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.5e+15) {
tmp = a * Math.log(t);
} else {
tmp = (Math.log(z) - t) + Math.log((x + y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.5e+15: tmp = a * math.log(t) else: tmp = (math.log(z) - t) + math.log((x + y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.5e+15) tmp = Float64(a * log(t)); else tmp = Float64(Float64(log(z) - t) + log(Float64(x + y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.5e+15) tmp = a * log(t); else tmp = (log(z) - t) + log((x + y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.5e+15], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.5 \cdot 10^{+15}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + \log \left(x + y\right)\\
\end{array}
\end{array}
if t < 1.5e15Initial program 99.5%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-undefine99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in a around inf 48.8%
*-commutative48.8%
Simplified48.8%
if 1.5e15 < 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.4%
Final simplification61.8%
(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.7%
+-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 65.5%
Taylor expanded in a around inf 73.7%
*-commutative73.7%
Simplified73.7%
Final simplification73.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 470.0) (log (* z y)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 470.0) {
tmp = log((z * y));
} 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 <= 470.0d0) then
tmp = log((z * y))
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 <= 470.0) {
tmp = Math.log((z * y));
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 470.0: tmp = math.log((z * y)) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 470.0) tmp = log(Float64(z * y)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 470.0) tmp = log((z * y)); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 470.0], N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 470:\\
\;\;\;\;\log \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 470Initial program 99.5%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-undefine99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in a around inf 55.2%
mul-1-neg55.2%
*-commutative55.2%
distribute-rgt-neg-in55.2%
Simplified55.2%
*-un-lft-identity55.2%
add-log-exp12.3%
sum-log9.3%
+-commutative9.3%
sub-neg9.3%
exp-sum9.3%
add-exp-log9.3%
add-sqr-sqrt4.6%
sqrt-unprod7.9%
sqr-neg7.9%
sqrt-unprod3.3%
add-sqr-sqrt7.0%
distribute-rgt-neg-out7.0%
add-sqr-sqrt3.7%
sqrt-unprod8.4%
sqr-neg8.4%
sqrt-unprod4.7%
add-sqr-sqrt9.3%
Applied egg-rr9.3%
*-lft-identity9.3%
Simplified9.3%
Taylor expanded in a around 0 8.4%
Taylor expanded in x around 0 5.9%
*-commutative5.9%
Simplified5.9%
if 470 < 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 75.5%
neg-mul-175.5%
Simplified75.5%
Final simplification37.5%
(FPCore (x y z t a) :precision binary64 (if (<= t 4.5e+17) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 4.5e+17) {
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 <= 4.5d+17) 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 <= 4.5e+17) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 4.5e+17: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 4.5e+17) 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 <= 4.5e+17) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 4.5e+17], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.5 \cdot 10^{+17}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 4.5e17Initial program 99.5%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-undefine99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in a around inf 48.8%
*-commutative48.8%
Simplified48.8%
if 4.5e17 < 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.9%
neg-mul-179.9%
Simplified79.9%
Final simplification61.8%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.7%
associate-+l-99.7%
associate--l+99.7%
sub-neg99.7%
+-commutative99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-undefine99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
metadata-eval99.7%
metadata-eval99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in t around inf 35.7%
neg-mul-135.7%
Simplified35.7%
Final simplification35.7%
(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 2024059
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:alt
(+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))