File: test_mpfr4_fused.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 (32 lines) | stat: -rw-r--r-- 729 bytes parent folder | download | duplicates (4)
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
Test MPFR4 specific fused multiply/add functions
================================================

>>> import gmpy2
>>> from gmpy2 import ieee, mpz, mpq, mpfr, mpc, fmma, fmms

>>> fmma(2,3,4,5)
mpz(26)
>>> fmma(2,3,-4,5)
mpz(-14)
>>> fmma(2.0,3,-4, mpq(5))
mpfr('-14.0')
>>> fmma(2,3.0,-4,5)
mpfr('-14.0')
>>> fmma(2,3,-4.0,5)
mpfr('-14.0')
>>> fmma(2,mpfr(3),-4.0,5)
mpfr('-14.0')
>>> fmma(mpc(2),mpfr(3),-4.0,5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: fmma() argument type not supported
>>> fmms(2,3,4,5)
mpz(-14)
>>> fmms(2,3,-4,5)
mpz(26)

>>> ieee(128).fmma(7,1/7,-1,3/11)
mpfr('0.727272727272727237401994671017746441',113)
>>> ieee(128).fmma(7,mpq(1,7),-1,mpq(3,11))
mpq(8,11)