Subject RE: [IBO] Rounding problems
Author Leigh J. Worthing
The best practices of numerical analysis says this (the even odd rule)
is the most accurate way to handle rounding off with data samples. You
will have to write your own routine to give the client what he wants.

Leigh

-----Original Message-----
From: news@... [mailto:news@...] On Behalf Of
Pirtea Calin
Sent: Thursday, May 16, 2002 9:38 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] Rounding problems

I've encountered a rounding problem with int64 numerics
using Delphi5 Pro and IBO4.2.Hc. When rounding 10.5 it results
10 witch is not ok for my client.

I've looked up the round definition from delphi help and
"If X is exactly halfway between two whole numbers,
the result is always the even number."
That is not acceptable. When X is exactly halfway
between two whole numbers, the result my client wants is always
the greater number. I don't have any other Delphi available to check
if round works the same but for me is definately a problem.
In IBO file IB_Utils function ExtendedToInt64 the last line does
Result := Round( AVal );
I've changed it to
if (Round( AVal )+0.5)=AVal then Result := Round( AVal )+1
else Result := Round( AVal );
in order to round always up when x=integer part +0.5

Is the normal behaviour of round wanted by the rest of you?
Or maybe this is the way you want it to work too?

Please state your opinion.
I just want to know if i'm alone on this or maybe is important for
others too.

TIA

--
Best regards,
Application Developer
Pirtea Calin Iancu
S.C. SoftScape S.R.L.
pcalin@...



________________________________________________________________________
___
IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
without the need for BDE, ODBC or any other layer.
________________________________________________________________________
___
http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
keyword-searchable FAQ, community code contributions and more !


Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/