# New Ticket Created by  Bernhard Schmalhofer 
# Please include the string:  [perl #36330]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=36330 >


The current state of  big numbers and extended decimal arithmetic in 
Parrot is mildly confusing.

In 'pdd17_basic_types.pod' there is a BigNum PMC mentioned, being a 
wrapper around a low-level BigNum type. This low level BigNum type is 
kind of documented in 'docs/pdds/pdd14_bignum.pod'. An implementation is 
started in the directory 'types'. However this implementation is nowhere 
used in Parrot.

There is an implementation, based on GMP, of a BigInt PMC in 'classes'. 
The implementation is tested in 't/pmc/bigint.t'. But the BigInt PMC is 
not mentioned in 'pdd17_basic_types.pod'.

'vtable.tbl' mentions the vtable methods:
   PMC* get_bignum()
   void set_bignum_int(INTVAL value)
   void set_bignum_num(FLOATVAL value)
   void set_bignum_str(STRING* value)
However only 'get_bignum' and 'set_bignum_int' are mentioned in 
'pdd02_vtables.pod'. These vtable are propably meant for dealing with 
overflows on assignment. But it looks they are not consistently used.

I propose following actions:

- update pdd17_basic_types.pod: BigInt and BigNum are PMCs, behavior on 
overflowing assignment
- Provide a GMP based implementation of BigNum PMC
- Add a complete test suite, see types/bignum_test.pl,  
http://www2.hursley.ibm.com/decimal/dectest.html
- clean up the 'types' directory
- Specify an API for plugging in other BigNum libraries, the 
implementation in 'types' could conform to that API

Reply via email to