I would like to use the built-in Round() function, but its getting masked by the round() function if fp.pas in the Universal Interfaces, and they are not compatible (one returns a Integer, the other a double).
In the past, with other Pascal dialects, I have solved this by using System.Round() to get the built-in routine, but I don't believe this syntax is supported by GPC.
Is there a simple solution to this?
One option would be to make a unit like:
unit SystemRoundUnit;
interface
function SystemRound( x: Real ): Integer;
implementation
function SystemRound( x: Real ): Integer; begin return Round( x ); end;
end.
(untried, untested, uncompiled)
At 10:03 PM +0000 20/2/05, steven.borley wrote:
Another thing. I noticed is that trunc() has been renamed to truncd() in fp.pas and there is a comment on the microbizz site (http://www.microbizz.nl/gpcdiffs.html) that says this...
So this looks like the same problem as I have with Round(), but with a different solution. So I'm now beginning to think think this is a GPCPInterfaces bug (or at least inconsistency). Should round() in fp.pas not have been renamed roundd() for the same reasons?
The argument could certainly made that this is inconsistent. I have no objections to the change, if Gale & Adriaan agree.
Enjoy, Peter.