Subject Re: double precision range question
Author Lee
While the scale of the number fits within in the +/-1.797e+308 range,
your number is too precise. IOW, you have too many digits. According
to the IB/FB docs I have on hand, double precision numbers can only
store 15 digits, not the 30 you attempt to stuff in there.

If you want to store up to 18 digits, use a numeric or decimal.
Incidentally, when working with monetary values it is generally much
preferred to use non-floating point values (like numeric or decimal in
a database; BCD, etc. in the app) to avoid rounding problems.

Hey, mind if you add a field with my name and a wealth value having 15
digits with the decimal at the end? Many thanks....

Lee

--- In firebird-support@yahoogroups.com, "knisco99" <knisco99@...> wrote:
>
> 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
>