
(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 (+ 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 t) (- a 0.5))))
(if (<= (+ (log (+ x y)) (log z)) 720.0)
(- (+ (log (* (+ x y) z)) t_1) t)
(- 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 ((log((x + y)) + log(z)) <= 720.0) {
tmp = (log(((x + y) * z)) + t_1) - t;
} 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 ((log((x + y)) + log(z)) <= 720.0d0) then
tmp = (log(((x + y) * z)) + t_1) - t
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 ((Math.log((x + y)) + Math.log(z)) <= 720.0) {
tmp = (Math.log(((x + y) * z)) + t_1) - t;
} 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 (math.log((x + y)) + math.log(z)) <= 720.0: tmp = (math.log(((x + y) * z)) + t_1) - t 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 (Float64(log(Float64(x + y)) + log(z)) <= 720.0) tmp = Float64(Float64(log(Float64(Float64(x + y) * z)) + t_1) - t); 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 ((log((x + y)) + log(z)) <= 720.0) tmp = (log(((x + y) * z)) + t_1) - t; 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[N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], 720.0], N[(N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] - t), $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}\;\log \left(x + y\right) + \log z \leq 720:\\
\;\;\;\;\left(\log \left(\left(x + y\right) \cdot z\right) + t\_1\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial 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%
associate-+r-99.5%
fma-undefine99.5%
associate--r+99.5%
sum-log97.7%
Applied egg-rr97.7%
if 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.7%
Taylor expanded in t around inf 99.8%
Taylor expanded in t around inf 81.8%
neg-mul-181.8%
Simplified81.8%
Final simplification94.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (log t) (- a 0.5))))
(if (<= (+ (log (+ x y)) (log z)) 720.0)
(- (+ (log (* y z)) t_1) t)
(- 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 ((log((x + y)) + log(z)) <= 720.0) {
tmp = (log((y * z)) + t_1) - t;
} 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 ((log((x + y)) + log(z)) <= 720.0d0) then
tmp = (log((y * z)) + t_1) - t
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 ((Math.log((x + y)) + Math.log(z)) <= 720.0) {
tmp = (Math.log((y * z)) + t_1) - t;
} 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 (math.log((x + y)) + math.log(z)) <= 720.0: tmp = (math.log((y * z)) + t_1) - t 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 (Float64(log(Float64(x + y)) + log(z)) <= 720.0) tmp = Float64(Float64(log(Float64(y * z)) + t_1) - t); 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 ((log((x + y)) + log(z)) <= 720.0) tmp = (log((y * z)) + t_1) - t; 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[N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], 720.0], N[(N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] - t), $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}\;\log \left(x + y\right) + \log z \leq 720:\\
\;\;\;\;\left(\log \left(y \cdot z\right) + t\_1\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial 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%
add-sqr-sqrt36.2%
pow236.2%
Applied egg-rr36.3%
Taylor expanded in x around 0 64.4%
if 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.7%
Taylor expanded in t around inf 99.8%
Taylor expanded in t around inf 81.8%
neg-mul-181.8%
Simplified81.8%
Final simplification68.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (log t) (- a 0.5)))) (if (<= t 1.3e-7) (+ (log (+ x y)) (+ (log z) t_1)) (- 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 <= 1.3e-7) {
tmp = log((x + y)) + (log(z) + t_1);
} 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 <= 1.3d-7) then
tmp = log((x + y)) + (log(z) + t_1)
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 <= 1.3e-7) {
tmp = Math.log((x + y)) + (Math.log(z) + t_1);
} 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 <= 1.3e-7: tmp = math.log((x + y)) + (math.log(z) + t_1) 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 <= 1.3e-7) tmp = Float64(log(Float64(x + y)) + Float64(log(z) + t_1)); 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 <= 1.3e-7) tmp = log((x + y)) + (log(z) + t_1); 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, 1.3e-7], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + t$95$1), $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 1.3 \cdot 10^{-7}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t\\
\end{array}
\end{array}
if t < 1.29999999999999999e-7Initial program 99.1%
associate-+l-99.1%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-undefine99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in t around 0 99.1%
if 1.29999999999999999e-7 < t Initial program 99.9%
Taylor expanded in t around inf 99.9%
Taylor expanded in t around inf 99.9%
neg-mul-199.9%
Simplified99.9%
Final simplification99.5%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.3e-7) (+ (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 <= 1.3e-7) {
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 <= 1.3d-7) 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 <= 1.3e-7) {
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 <= 1.3e-7: 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 <= 1.3e-7) 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 <= 1.3e-7) 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, 1.3e-7], 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 1.3 \cdot 10^{-7}:\\
\;\;\;\;\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 < 1.29999999999999999e-7Initial program 99.1%
associate--l+99.1%
+-commutative99.1%
associate-+l+99.2%
+-commutative99.2%
fma-define99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
add-log-exp40.3%
+-commutative40.3%
exp-sum35.7%
fma-undefine35.7%
metadata-eval35.7%
sub-neg35.7%
exp-sum35.7%
add-exp-log35.8%
sub-neg35.8%
metadata-eval35.8%
*-commutative35.8%
exp-to-pow35.9%
exp-diff35.9%
add-exp-log36.2%
Applied egg-rr36.2%
associate-*l*40.4%
associate-*r/40.4%
*-commutative40.4%
+-commutative40.4%
Simplified40.4%
Taylor expanded in t around 0 35.9%
*-commutative35.9%
remove-double-neg35.9%
neg-mul-135.9%
sub-neg35.9%
metadata-eval35.9%
associate-*r*35.9%
log-rec35.9%
metadata-eval35.9%
sub-neg35.9%
mul-1-neg35.9%
log-rec35.9%
sub-neg35.9%
metadata-eval35.9%
distribute-lft-neg-in35.9%
remove-double-neg35.9%
Simplified36.1%
Taylor expanded in y around inf 29.0%
exp-to-pow29.0%
sub-neg29.0%
metadata-eval29.0%
mul-1-neg29.0%
log-rec29.0%
remove-double-neg29.0%
Simplified29.0%
*-commutative29.0%
log-prod30.8%
pow-to-exp30.8%
rem-log-exp62.7%
Applied egg-rr62.7%
if 1.29999999999999999e-7 < t Initial program 99.9%
Taylor expanded in t around inf 99.9%
Taylor expanded in t around inf 99.9%
neg-mul-199.9%
Simplified99.9%
Final simplification81.4%
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (log t) (- a 0.5))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + (log(t) * (a - 0.5));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + (log(t) * (a - 0.5d0))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + (Math.log(t) * (a - 0.5));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + (math.log(t) * (a - 0.5))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(log(t) * Float64(a - 0.5))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + (log(t) * (a - 0.5)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \log t \cdot \left(a - 0.5\right)
\end{array}
Initial program 99.5%
Final simplification99.5%
(FPCore (x y z t a) :precision binary64 (+ (- (log z) t) (+ (* (log t) (- a 0.5)) (log y))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + ((log(t) * (a - 0.5)) + log(y));
}
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(t) * (a - 0.5d0)) + log(y))
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(z) - t) + ((Math.log(t) * (a - 0.5)) + Math.log(y));
}
def code(x, y, z, t, a): return (math.log(z) - t) + ((math.log(t) * (a - 0.5)) + math.log(y))
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + Float64(Float64(log(t) * Float64(a - 0.5)) + log(y))) end
function tmp = code(x, y, z, t, a) tmp = (log(z) - t) + ((log(t) * (a - 0.5)) + log(y)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \left(\log t \cdot \left(a - 0.5\right) + \log y\right)
\end{array}
Initial program 99.5%
associate--l+99.5%
+-commutative99.5%
associate-+l+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 69.4%
Final simplification69.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -4.4e-58) (not (<= a 0.00305))) (- (* (log t) (- a 0.5)) t) (- (log (* (pow t -0.5) (* (+ x y) z))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -4.4e-58) || !(a <= 0.00305)) {
tmp = (log(t) * (a - 0.5)) - t;
} else {
tmp = log((pow(t, -0.5) * ((x + y) * z))) - t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-4.4d-58)) .or. (.not. (a <= 0.00305d0))) then
tmp = (log(t) * (a - 0.5d0)) - t
else
tmp = log(((t ** (-0.5d0)) * ((x + y) * z))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -4.4e-58) || !(a <= 0.00305)) {
tmp = (Math.log(t) * (a - 0.5)) - t;
} else {
tmp = Math.log((Math.pow(t, -0.5) * ((x + y) * z))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -4.4e-58) or not (a <= 0.00305): tmp = (math.log(t) * (a - 0.5)) - t else: tmp = math.log((math.pow(t, -0.5) * ((x + y) * z))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -4.4e-58) || !(a <= 0.00305)) tmp = Float64(Float64(log(t) * Float64(a - 0.5)) - t); else tmp = Float64(log(Float64((t ^ -0.5) * Float64(Float64(x + y) * z))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -4.4e-58) || ~((a <= 0.00305))) tmp = (log(t) * (a - 0.5)) - t; else tmp = log(((t ^ -0.5) * ((x + y) * z))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -4.4e-58], N[Not[LessEqual[a, 0.00305]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(N[Power[t, -0.5], $MachinePrecision] * N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.4 \cdot 10^{-58} \lor \neg \left(a \leq 0.00305\right):\\
\;\;\;\;\log t \cdot \left(a - 0.5\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log \left({t}^{-0.5} \cdot \left(\left(x + y\right) \cdot z\right)\right) - t\\
\end{array}
\end{array}
if a < -4.40000000000000011e-58 or 0.00305000000000000019 < a Initial program 99.8%
Taylor expanded in t around inf 99.8%
Taylor expanded in t around inf 96.1%
neg-mul-196.1%
Simplified96.1%
if -4.40000000000000011e-58 < a < 0.00305000000000000019Initial program 99.2%
associate--l+99.2%
+-commutative99.2%
associate-+l+99.3%
+-commutative99.3%
fma-define99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
add-log-exp44.4%
+-commutative44.4%
exp-sum39.0%
fma-undefine39.0%
metadata-eval39.0%
sub-neg39.0%
exp-sum39.0%
add-exp-log39.1%
sub-neg39.1%
metadata-eval39.1%
*-commutative39.1%
exp-to-pow39.2%
exp-diff39.2%
add-exp-log39.5%
Applied egg-rr39.5%
associate-*l*44.9%
associate-*r/44.4%
*-commutative44.4%
+-commutative44.4%
Simplified44.4%
Taylor expanded in a around 0 43.0%
Taylor expanded in t around inf 43.0%
unpow1/243.0%
exp-to-pow42.8%
log-rec42.8%
distribute-lft-neg-out42.8%
distribute-rgt-neg-in42.8%
metadata-eval42.8%
exp-to-pow43.0%
associate-/l*43.0%
rem-exp-log43.0%
exp-diff43.1%
log1p-expm131.7%
log1p-undefine31.7%
rem-exp-log31.7%
log1p-undefine31.7%
log1p-expm171.2%
Simplified71.2%
Final simplification85.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 9.2e+17) (* (log t) a) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 9.2e+17) {
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 <= 9.2d+17) 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 <= 9.2e+17) {
tmp = Math.log(t) * a;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 9.2e+17: tmp = math.log(t) * a else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 9.2e+17) 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 <= 9.2e+17) tmp = log(t) * a; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 9.2e+17], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9.2 \cdot 10^{+17}:\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 9.2e17Initial program 99.2%
associate-+l-99.2%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-undefine99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in a around inf 51.7%
*-commutative51.7%
Simplified51.7%
if 9.2e17 < 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 76.5%
neg-mul-176.5%
Simplified76.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%
Taylor expanded in t around inf 99.5%
Taylor expanded in t around inf 77.1%
neg-mul-177.1%
Simplified77.1%
Final simplification77.1%
(FPCore (x y z t a) :precision binary64 (+ (* t (+ (/ 1.0 t) -1.0)) -1.0))
double code(double x, double y, double z, double t, double a) {
return (t * ((1.0 / t) + -1.0)) + -1.0;
}
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 * ((1.0d0 / t) + (-1.0d0))) + (-1.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return (t * ((1.0 / t) + -1.0)) + -1.0;
}
def code(x, y, z, t, a): return (t * ((1.0 / t) + -1.0)) + -1.0
function code(x, y, z, t, a) return Float64(Float64(t * Float64(Float64(1.0 / t) + -1.0)) + -1.0) end
function tmp = code(x, y, z, t, a) tmp = (t * ((1.0 / t) + -1.0)) + -1.0; end
code[x_, y_, z_, t_, a_] := N[(N[(t * N[(N[(1.0 / t), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(\frac{1}{t} + -1\right) + -1
\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 38.0%
neg-mul-138.0%
Simplified38.0%
expm1-log1p-u1.5%
expm1-undefine1.4%
Applied egg-rr1.4%
sub-neg1.4%
log1p-undefine1.4%
rem-exp-log37.9%
unsub-neg37.9%
metadata-eval37.9%
Simplified37.9%
Taylor expanded in t around inf 38.0%
Final simplification38.0%
(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 38.0%
neg-mul-138.0%
Simplified38.0%
(FPCore (x y z t a) :precision binary64 0.0)
double code(double x, double y, double z, double t, double a) {
return 0.0;
}
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 = 0.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
return 0.0;
}
def code(x, y, z, t, a): return 0.0
function code(x, y, z, t, a) return 0.0 end
function tmp = code(x, y, z, t, a) tmp = 0.0; end
code[x_, y_, z_, t_, a_] := 0.0
\begin{array}{l}
\\
0
\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 38.0%
neg-mul-138.0%
Simplified38.0%
expm1-log1p-u1.5%
expm1-undefine1.4%
Applied egg-rr1.4%
sub-neg1.4%
log1p-undefine1.4%
rem-exp-log37.9%
unsub-neg37.9%
metadata-eval37.9%
Simplified37.9%
Taylor expanded in t around 0 2.4%
metadata-eval2.4%
Applied egg-rr2.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 2024172
(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))))