[Lazarus] Lazarus 0.9.26, 0.9.26.1, 0.9.26.2, 0.9.27 ou 0.9.28? (Silvio Clécio)
Silvio Clécio
silvioprog at yahoo.com.br
Mon Feb 16 05:20:31 CET 2009
On Sat, 14 Feb 2009 12:30:55 +0200
Dave Coventry <dgcoventry at gmail.com> wrote:
> function mycalc( num1,num2: real):integer;
> begin
> Result:=trunc(num1*num2);
> end;
>
> How can I protect from the product of the two numbers being too big?
>
> If it's too big I want to discard it anyway.
function mycalc( num1,num2: real):integer;
begin
Result:=trunc(num1*num2);
if result > maxint then result := 0;
end;
Would this do what you want?
Howard Page-Clark <hdpc at talktalk.net>
More information about the Lazarus
mailing list