#10596: Misc improvements to integer.pyx
--------------------------------+-------------------------------------------
Reporter: spancratz | Owner: AlexGhitza
Type: enhancement | Status: needs_review
Priority: trivial | Milestone: sage-4.8
Component: basic arithmetic | Keywords:
Work_issues: | Upstream: N/A
Reviewer: Aly Deines | Author: Sebastian Pancratz
Merged: | Dependencies:
--------------------------------+-------------------------------------------
Old description:
> Generic code clean-up such as line breaks, empty lines, use of GMP
> functions etc
>
> ``n.digits()``
>
> Before:
> {{{
> sage: ZZ(0).ndigits()
> 0
> sage: ZZ(0).ndigits(base=2)
> 0
> sage: ZZ(0).nbits()
> 1
> }}}
>
> After:
> {{{
> sage: ZZ(0).ndigits()
> 1
> sage: ZZ(0).ndigits(base=2)
> 1
> sage: ZZ(0).nbits()
> 1
> }}}
>
> Before:
> {{{
> sage: x = factorial(2**14)
> sage: timeit('y = odd_part(x)')
> 625 loops, best of 3: 10.6 µs per loop
> }}}
> {{{
> sage: odd_part(0)
> ---------------------------------------------------------------------------
> ...
> TypeError: unsupported operands for >>: 0, +Infinity
> }}}
> After:
> {{{
> sage: x = factorial(2**14)
> sage: timeit('y = x.odd_part()')
> 625 loops, best of 3: 4.52 µs per loop
> }}}
> {{{
> sage: ZZ(0).odd_part()
> 0
> }}}
>
> Apply trac_10596.patch, trac_10596_remove_trailing_whitespaces.patch
New description:
Generic code clean-up such as line breaks, empty lines, use of GMP
functions etc
Before:
{{{
sage: x = factorial(2**14)
sage: timeit('y = odd_part(x)')
625 loops, best of 3: 10.6 µs per loop
}}}
{{{
sage: odd_part(0)
---------------------------------------------------------------------------
...
TypeError: unsupported operands for >>: 0, +Infinity
}}}
After:
{{{
sage: x = factorial(2**14)
sage: timeit('y = x.odd_part()')
625 loops, best of 3: 4.52 µs per loop
}}}
{{{
sage: ZZ(0).odd_part()
0
}}}
'''Apply''' [attachment:trac_10596.patch],
[attachment:trac_10596_remove_trailing_whitespaces.patch]
--
Comment(by aapitzsch):
I removed the ''ndigits()'' part because problem was fixed in #11796.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10596#comment:16>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.