>>>>> "AG" == Alex Gough <alexander.gough@st-hughs.oxford.ac.uk> writes: AG> Can I propose that we aim to support the Standard Decimal Arithmetic, AG> this will allow us to make use of an extensive test suite and claim AG> Enterprise-Bonus-Points at the appropriate time: AG> http://www2.hursley.ibm.com/decimal/ i will look at it. AG> Looking through the current code, I wonder why we are bothering to AG> have a distinction between the fractional and integer parts of AG> each number, to me it seems simpler to use a single string of AG> digits with a signed exponent as multiplying two numbers then AG> merely requires multiplying the digit strings and adding the AG> exponents directly. there is only a distinction between those parts so we can locate the decimal point. once two numbers are being processed (added, multiplied), they look like one long decimal string. there are two pieces of scaling info, the number of integer/fraction digits (their related word counts are for efficiency) and the signed external exponent. note that we are supporting a fixed (but growable) precision which is not well understood by most bignum advocates. a given bignum will have a maximum number of actual digits stored which is the precision. within that range could be the decimal point (which is always on a word boundary for efficiency). if the precision is shorter than the scale of the number (in either direction) the exponent is used to make up for the extra scaling needed. there will be a need to take a number (assigned or calculated) and find its first (highest) and last (lowest) non-zero digit so we can store its current integer/fraction digits info. this will effectively be our 'normalization' operation. i need to get back into code hacking on this. i have been off of it for several weeks. someone kick me regularly so i get some work done. once i get scaled addition going and some precision support (copying with changed precision), then multiplication will follow quickly. most of the design is done in my head (as i have done decimal math libs before) but the coding is different with the new precision which is changeable. uri -- Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com -- Stem is an Open Source Network Development Toolkit and Application Suite - ----- Stem and Perl Development, Systems Architecture, Design and Coding ---- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.orgThread Previous | Thread Next