Subject | Re[2]: [ib-support] Re: IB dumber than a $5 calculator |
---|---|
Author | Mpu Gondrong |
Post date | 2002-05-30T16:32:05Z |
Kamis, 30/05/02 21:42:22, Paul menulis:
PR> The problem arises when division is carried out on integers.
PR> select (3 / 10) * 3.333 from rdb$database;
I don't think this issue about casting in FB, but floating point
division error. This is (long standing?) bug that stil exist in
FirebirdSS 1.0.0.796 (dialect 3 only, as it uses Int64).
I made another little test (in dialect 1):
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
And compared with Delphi:
function Hitung(Par: Integer): Currency;
var
D: Currency;
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;
And the result is no different.
Tertanda,
Oguds [36856104]
PR> The problem arises when division is carried out on integers.
PR> select (3 / 10) * 3.333 from rdb$database;
I don't think this issue about casting in FB, but floating point
division error. This is (long standing?) bug that stil exist in
FirebirdSS 1.0.0.796 (dialect 3 only, as it uses Int64).
I made another little test (in dialect 1):
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
And compared with Delphi:
function Hitung(Par: Integer): Currency;
var
D: Currency;
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;
And the result is no different.
Tertanda,
Oguds [36856104]