Decimal arithmetic

Linas Vepstas linas at austin.ibm.com
Wed Apr 4 19:31:26 CEST 2007


On Wed, Apr 04, 2007 at 01:46:13PM -0300, Décio Luiz Gazzoni Filho wrote:
> 
> I've been asked off-list by a former member about digit extraction  
> functions in GMP. I've given the usual lecture about how digit  
> extraction is a slow operation if the library does binary arithmetic,  
> since it requires a base-2 to base-10 conversion. With that said, a  
> base-10 library would provide efficient digit extraction while not  
> sacrificing much performance.
> 
> So what are the choices of libraries that support base-10 arithmetic?  

FWIW, some history of base-10:
-- IBM mainframes have supported base-10 arithmetic since the 1960's.
   This was primarily to support accounting, in order to make life
   easier for banks and utilities and anyone who sent out zillions
   of invoices every month.

-- This base-10 arith has been backwards-compat supported all those
   decades, and is now making its debut on a modern CPU, the Power6
   due to ship "any day now". As a result, base-10 arithmetic support
   was proposed to ANSI as a libc or libm math standard, and I beleive
   the standard was recently (last year or two) accepted.

-- I don't beleive that it is widely supported in general. The only
   hardware support will be on power6, so I don't see much point in 
   doing base-10 aritmetic on anything other than that. 

> Décio

Unless, of course, this is another one of those "poisson d'avril" 
emails.



More information about the gmp-discuss mailing list