| Description |  
The Sqr function returns the square of a Number.
   
Sqr(Number) = Number * Number
   
The number may be an integer or floating point type.
   
Integer, Int64 numbers
   
If the square of the number exceeds the capacity of the target variable, then the result is :
   
Result Mod Capacity
   
Extended numbers
   
If the square of the number exceeds the capacity, EOverFlow exception is raised.
   
Special values are treated as follows:
   
| Infinity, -Infinity  |  : Infinity |  
| NaN (Not a Number)  |  : NaN |   
 |  
 |  
| Related commands |  
| Dec | 
 | 
Decrement an ordinal variable | 
 
| Inc | 
 | 
Increment an ordinal variable | 
 
| Sqrt | 
 | 
Gives the square root of a number | 
 
| Sum | 
 | 
Return the sum of an array of floating point values | 
 
 
 | 
 
 
 | 
  | 
| Example code : Find the square of various values |  
 var 
  number, squared : Byte; 
  float : Extended; 
 
begin   // The square of 15 = 225 
  number  := 15; 
  squared := Sqr(number); 
  ShowMessageFmt('%d squared = %d',[number, squared]); 
   // The square of 17 = 289   // But result exceeds byte size, so result = 289 MOD 256 = 33 
  number  := 17; 
  squared := Sqr(number); 
  ShowMessageFmt('%d squared = %d (see code above)',[number, squared]); 
   // The square of infinity is still infinity 
  float := Infinity; 
  float := Sqr(float); 
  ShowMessageFmt('Infinity squared = %f',[float]); 
end; 
 |  
 
| Show full unit code | 
 
   15 squared = 225   
17 squared = 33 (see code above)   
Infinity squared = INF 
 
 |  
 
 |