Subject Re: [firebird-support] About arithmetic in Firebird
Author Helen Borrie
At 02:06 PM 31/10/2005 +0800, you wrote:
>Hello,
> I want to know how to solution X/Y = Z (like12/8 = 1.5) in store
> procedure.
>

Integer/integer division:

12/8 = 1
10/8 = 1

Real number in one operand:

12.0/8 = 1.5
1.00/8 = 1.25

or

12/8.0 = 1.5
10/8.0 = 1.2
10/8.00 = 1.25

Real numbers in both operands:

12.00/8.00 = 1.5000

So, if you have two integers, include a real multiplier:

(X * 1.00)/Y
or
X/(Y * 1.00)

It's not just in SPs, it applies to all SQL arithmetic.

./heLen