Subject Re: integer division & casting
Author csswa
Try it with a pair of divided integers, e.g.

result = Par / Par + 1 * 3.1415 + 5.4321 * 5 - 4 / 9 * 4.2456;

The solution is to cast Par as a double. Any division operatation
that potentially produces a real number needs at least one of the
operands to be a double to calculate correctly. However
multiplication does not require this explicit casting.

Regards,
Andrew Ferguson
-- I put the dot-com in Andrew.Com.



--- In ib-support@y..., Mpu Gondrong <wawan@s...> wrote:
> Kamis, 30/05/02 21:42:22, Paul menulis:
> CREATE PROCEDURE SP_TEST_2 (PAR INTEGER)
> returns (RESULT NUMERIC(15,4))
> AS
> declare variable D Numeric(15,4);
> begin
> D = Par / 0.333 * 3.1415 + 5.4321 * 1.5678 - 0.318 / 3.5791 *
4.2456;
> Result = D / 1.451 - 5.1236 * 0.5 + 0.1234 * 4.1567;
> end