summaryrefslogtreecommitdiff
path: root/docs/lib/bps.numeric.rst
blob: 1fff92802d0320c8681e49e38d137fe35494d126 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
=================================================
:mod:`bps.numeric` -- Numeric Tools
=================================================

.. module:: bps.numeric
    :synopsis: mathematical and numeric tools

Number Theory
=============
.. autofunction:: factors
.. autofunction:: gcd
.. autofunction:: lcm

Primality Testing
=================
.. autofunction:: is_prime
.. autofunction:: next_prime
.. autofunction:: prev_prime
.. autofunction:: iter_primes

Numeric Formats
===============
.. autofunction:: int_to_base
.. autofunction:: float_to_base
.. autofunction:: int_to_roman
.. autofunction:: roman_to_int

Miscellaneous Functions
=======================
.. autofunction:: sdivmod
.. autofunction:: splitfrac
.. autofunction:: avgsd
.. autofunction:: digits
.. autofunction:: limit

Bytes Strings
=============
The following functions manipulate strings
as if they were binary data, not characters.
They allow for doing bit-wise boolean operations
on strings, converting them to integers, etc.

.. note::
    When this module is converted to Python 3.0,
    these will all be operations on ``bytes``, not ``str``.

.. autofunction:: int_to_bytes
.. autofunction:: bytes_to_int
.. autofunction:: list_to_bytes
.. autofunction:: bytes_to_list
.. autofunction:: xor_bytes
.. autofunction:: or_bytes
.. autofunction:: and_bytes
.. autofunction:: invert_bytes
.. autofunction:: binop_bytes