File: test_mpq_to_from_binary.txt

package info (click to toggle)
python-gmpy2 2.1.0~a4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,048 kB
  • sloc: ansic: 24,051; python: 325; makefile: 117
file content (18 lines) | stat: -rw-r--r-- 430 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Testing of gmpy2 mpq to_binary and from_binary
----------------------------------------------

    >>> import gmpy2
    >>> from gmpy2 import mpq,to_binary,from_binary

Test
----

    >>> x=mpq(0,1);x==from_binary(to_binary(x))
    True
    >>> x=mpq(1,1);x==from_binary(to_binary(x))
    True
    >>> x=mpq(-1,2);x==from_binary(to_binary(x))
    True
    >>> x=mpq(123456789123456789,9876);x==from_binary(to_binary(x))
    True