You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Numeric values are stored with higher precision than declared. Such values are not visible by a simple select, but become visible when multiplied by a bigger number.
Example:
- declaration of variable N in table T is Numeric(15,2)
- update T set N =0.001234 where ID=1 sets variable to an invisible value
- select N from T where ID=1 returns 0.00 as expected
- select N*10000 from T where ID=1 returns 12.34 which is WRONG!
This gives unexpected results for example when calculating unit price * volume = total price,
because 0.00 * something should be 0.00 and not something else.
The text was updated successfully, but these errors were encountered:
What is the database dialect? It looks like it's Dialect 1. It you want exact numerics, you should be using Dialect 3, otherwise all numerics are approximate.
This is expected and well documented behaviour for legacy SQL DIALECT 1 databases. Exact (large) numerics require SQL DIALECT 3, which is the default dialect for new databases since Firebird 0.9.
Submitted by: Martin Pavlik (quitec)
Numeric values are stored with higher precision than declared. Such values are not visible by a simple select, but become visible when multiplied by a bigger number.
Example:
- declaration of variable N in table T is Numeric(15,2)
- update T set N =0.001234 where ID=1 sets variable to an invisible value
- select N from T where ID=1 returns 0.00 as expected
- select N*10000 from T where ID=1 returns 12.34 which is WRONG!
This gives unexpected results for example when calculating unit price * volume = total price,
because 0.00 * something should be 0.00 and not something else.
The text was updated successfully, but these errors were encountered: