Subject RE: [firebird-support] double precision range question
Author Svein Erling Tysvær
Precision and range are not the same. I for one know (or rather, think I've heard) that one centillion is a 1 followed by 600 zeroes, but that doesn't mean that I'm able to store a number containing 600 digits in my brain. Likewise with Firebird, it can store numbers up to 1.797e+308 (I take your word for it), but with a precision only up to 18 digits (that is, up to 2^63, which is a 19 digits number). Hence, I would expect Firebird to handle

insert into people (wealth) values (1234567890123456789E100), but not
insert into people (wealth) values (12345678901234567890.0123456789)

I'm answering simply because no-one else seem to have given you any answer (I think this is the right group for your question), I really do not know anything about such large numbers. E.g. I have no opinion whether an error is the appropriate response when trying to insert a value with too high precision or if there should be some way of truncating the value to the maximum precision.

For now, I think you have to use character fields (CHAR, VARCHAR or BLOB SUBTYPE 1) if you need to store huge numbers with more precision than can fit in a 64 bit field.

Set

-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of knisco99
Sent: 20. november 2007 14:55
To: firebird-support@yahoogroups.com
Subject: [firebird-support] double precision range question

I have a Firebird 2.0 database running on Linux. I've created a table
that looks like this

create table people (
wealth double precision
)

I'm then trying to run the following insert

insert into people (wealth) values (12345678901234567890.0123456789)

I get the following error

Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 1, char 37.
1.

Looking through the Firebird book, the section on double precision
says that it should support values in the range -1.797e+308 to
1.797e+308 so it seems like my number in my insert statement should
fit into this criteria. Am I doing something wrong? One more strange
thing, if I reduce the number in my insert statement to a number that
has a precision of 18 then it will insert. 18 is also the limit for a
numeric/decimal field. This seems like an odd coincidence. Can anyone
provide some insight into this?

Thanks,
Scott Knight