Hi.

On Mon 2003-01-20 at 15:05:46 -0700, [EMAIL PROTECTED] wrote:
> We need to store numbers that exceed the precision of the DOUBLE
> datatype. The mysql manual makes no mention of a size bigger than
> DOUBLE. Storing the number as a string is not preferable because of the
> extra space a character string would take up. One thought is to store
> two integers: the digits to the right and left of the decimal place. 

With INT that gives you 10 digits before and 10 after the decimal
point. Note that double is considered to have a precision of 15-16
digits.

But I would BIGINT instead and just define how to calculate down to
the decimal point (either by dividing by 10^10 or 2^32).

> The question is: is there an easier way to do this that would take up
> less space than a DECIMAL column...

No, the question is: what do you want to do with these numbers? :-)

Do you want to run any operation than simply storing and retrieving
these numbers? If not, you can simply use CHAR(16) or something like
that and store the binary representation of the number. I presume that
you have something like that... it wouldn't make much sense to store
high precision number, if you use double within your application.

If you want to use database functions like AVG() or SUM(), this does
not work, of course.

> perhaps something like a long double
> column.

No there is no native column type that directly stores such numbers.

> Have I exhausted the available options? I got the feeling that I
> am going to have to go with the int*2 solution but I decided I would
> check with the 'experts' first.

For a more specific answer you need to tell us what those numbers are
and what you are going to do with them (what operations you need to
run on them).

HTH,

        Benjamin.


-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to