Subject Re: integer division & casting
Author csswa
Hmmm, this is getting interesting. I executed the exact same code on
WI-V6.2.794 Firebird 1.0, NT4sp6, AMD Duron system...

you got a result of: 29.4151
I got a result of: 31.302

Can we get some confirmation on this from other linux and win users,
please...

Here's my DDL/DML for double-checking...

SET TERM ^ ;
CREATE PROCEDURE SP_TEST_2
(PAR INTEGER)
RETURNS (RESULT NUMERIC(15,4))
AS
begin
result = Par / Par + 1 * 3.1415 + 5.4321 * 5 - 4 / 9 * 4.2456;
end
^
SET TERM ; ^

execute procedure sp_test_2(9);

Procedure executing results:
RESULT = 31.302


Regards,
Andrew Ferguson
-- Mars needs women; Firebird needs developers.


--- In ib-support@y..., Mpu Gondrong <wawan@s...> wrote:
> Jumat, 31/05/02 0:01:36, csswa menulis:
>
> c> Try it with a pair of divided integers, e.g.
> c> result = Par / Par + 1 * 3.1415 + 5.4321 * 5 - 4 / 9 * 4.2456;
>
> Have you tried that first ? I've tried like this:
>
> SQL> show version;
> ISQL Version: LI-T1.0.0.796 Firebird 1.0
> InterBase/linux Intel (access method), version "LI-T6.2.796
Firebird 1.0"
> InterBase/linux Intel (remote server), version "LI-T6.2.796
Firebird 1.0/tcp (sim.gatra.com)/P10"
> InterBase/linux Intel (remote interface), version "LI-T1.0.0.368
Firebird Beta2/tcp (sim.gatra.com)/P10"
> on disk structure version 10.0
> SQL> show sql dialect;
> Client SQL dialect is set to: 1 and database SQL dialect
is: 1
> SQL> show procedure sp_test_2;
> Procedure text:
>
======================================================================
=======
> begin
> result = Par / Par + 1 * 3.1415 + 5.4321 * 5 - 4 / 9 * 4.2456;
> end
>
======================================================================
=======
> Parameters:
> PAR INPUT INTEGER
> RESULT OUTPUT NUMERIC(15, 4)
> SQL> execute procedure sp_test_2(9);
> RESULT
> =======================
> 29.4151
>
> Tertanda,
> Oguds [36856104]