[fpc-pascal] Two questions about Pascal
    Jonas Maebe 
    jonas.maebe at elis.ugent.be
       
    Thu Jul 29 20:54:44 CEST 2010
    
    
  
On 29 Jul 2010, at 20:31, José Mejuto wrote:
> 1) Is there any way in Pascal to write something like this
> (pseudocode):
> 
> With Result:=Object.Create() do begin
>  Free;
> end;
Just leave out the "Result:=" part and it will compile/work fine..
> 2) Which is the expected way to detect if a float value is exact ?
> Maybe only applying "if V = trunc(V) then ..." ?
Use "if V = int(V) then ..." instead. trunc() converts to an int64 (which will then again be converted to a float), while int() returns a floating point type (with the fractional part removed).
Jonas
    
    
More information about the fpc-pascal
mailing list