Re: [HACKERS] numeric data type on 6.5

From: jwieck(at)debis(dot)com (Jan Wieck)
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas Lockhart)
Cc: jwieck(at)debis(dot)com, t-ishii(at)sra(dot)co(dot)jp, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] numeric data type on 6.5
Date: 1999-04-29 16:06:20
Message-ID: m10ctKO-000EBPC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Lockhart wrote:

> The float8_numeric() code already had checked for NULL and NaN, so I
> think this does not lose functionality. What do you think Jan? Should
> I make the change? Or is there another way??

Think it's O.K. - commit the changes.

The other way would be to enhance the NUMERIC input function
to read exponential notation. But I wouldn't do this now
because I've planned to someday implement NUMERIC again from
scratch.

The current implementation has a packed storage format and
the arithmetic operations are based on a character format
(each digit is stored in one byte). After thinking about it
I discovered, that storing the value internally in short
int's (16 bit) and base 10000 would have some advantages.

1. No need to pack/unpack storage format for computations.

2. One arithmetic operation in the innermost loops (only
add/subtract are really implemented) mucks with 4 digits
at a time.

The disadvantages are small. Base 10000 to base 10 (decimal)
conversion is easily to parse/print. Only rounding functions
will be a little tricky. I think the speedup gained from
adding/subtracting 4 digits per loop iteration will be worth
the efford.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck(at)debis(dot)com (Jan Wieck) #

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 1999-04-29 16:11:56 Re: [HACKERS] v6.5 Release Date ...
Previous Message José Soares 1999-04-29 15:45:10 Re: [SQL] LIMIT