Subject Re: [firebird-support] Arithmetic overflow or division by zero has occurred.
Author Ismael L. Donis Garcia
That operation does not give the precision that I need ( 6 digits after decimal point )

SELECT 54311.999455*cast((1/1.000001) as integer) as mount FROM MON$ATTACHMENTS r = 54311.999455

54311.999455 / 1.000001 = 54311,945143

Thank you for everything
=========
|| ISMAEL ||
=========
----- Original Message -----
From: Svein Erling Tysvær
To: 'firebird-support@yahoogroups.com'
Sent: Thursday, March 29, 2012 3:24 AM
Subject: RE: [firebird-support] Arithmetic overflow or division by zero has occurred.



>SELECT cast((5411.000455/0.000020) as numeric(16,6)) as mount FROM MON$ATTACHMENTS r

This particular query can be rewritten as

SELECT 5411.000455*cast(1/0.000020 as integer) as mount FROM MON$ATTACHMENTS r

Though it will not work equally well with other numbers, at least not if cast(1/0.xxxxxx as numeric(16, 4)) doesn't yield sufficient precision when doing 5411.000455*ResultFromAbove.

HTH,
Set




[Non-text portions of this message have been removed]