Subject Re: INTEGER BUG
Author colincoleman2002
--- In firebird-support@yahoogroups.com, Dimitry Sibiryakov <sd@...> wrote:
>
> > Why do we get an integer overflow with this code:
> >
> > select
> > cast(1.000 as numeric(18,10)) * 1.0000 * 1.000 * 1.0 * 1.0 from
> > rdb$database
>
> Because result has type numeric(18,19), where 19=10+4+3+1+1, that is
> impossible.
>
> > but not this one?
> >
> > select
> > cast(1.000 as numeric(18,10)) * 1.0000 * 1.0 * 1.0 * 1.0 from
> > rdb$database
>
> Because 10+4+1+1+1 = 17. Numeric (18,17) is possible.
>
> > This is a SERIOUS BUG!!
>
> In your head only. Read about precise arithmetic in Dialect 3.
>
> SY, SD.
>

I have reduced to problem we have in our database to a set of constants. (for example reasons), normaly this data is retrieved from a number of database fields that I have no control over.

How can I anticipate when this error will occour.

Why do the precisions ADD when i multiply...?

What is my solution ?

Colin