Field-Map Scripting

4.1.3.1.4 Round2int

Round2Int function



Prototype:

function Round2Int(X: double): integer;

Description:

The Round2Int function rounds the floating point value X to integer.

Syntax:

Round2Int(X); / variable:= Round2Int(X);


Part

Description


variable

A variable declared as integer


X

The unrounded value as a double

Return value:

Rounded value of the input value as integer



Example:

var  
  v, MeanOfHeight_m:variant;
  d :double;
  i:integer;
begin  
  OpenLog('Round results');   
    
  MeanOfHeight_m:=Trees_2013.GetMeanOfAttributeValues('Height_m','');      
  log(format('MeanOfHeight_m: %3.6f',[Variant2Float(MeanOfHeight_m)]));  log('');
  
  v:= RoundVariant(MeanOfHeight_m, 2); 
    log(format('RoundVariant (MeanOfHeight_m, 2): %3.2f',[Variant2Float(v)]));      

  d:=RoundTo(Variant2Float(MeanOfHeight_m),-2); 
    log(format('RoundTo (MeanOfHeight_m,-2): %3.2f',[d])); 
                             
  v:=Round(Variant2Float(MeanOfHeight_m),2);     
    log(format('Round (MeanOfHeight_m,2): %3.2f',[Variant2Float(v)]));

  i:=Round2int(d); 
    log(format('Round2int (MeanOfHeight_m): %6d',[i]));     
end.


See also:

Power; Round; RoundTo, RoundVariant; Round2int, Cos; ArcCos; ArcCosH; Sin; ArcSin; ArcSinH; ArcTan; ArcTan2; ArcTanH; CosH; SinH; Tan; TanH; Random; RandomRange; Randomize; Floor; Ceil; Int; Frac; Log10; Ln; Exp; Abs; Min; Max; Odd; SecondsBetween;CompareValue; SameValue; Trunc


Example