Integer Basics
Standard ML of New Jersey v110.78 [built: Thu Jul 23 11:21:58 2015]
- 6;
val it = 6 : int
- ~6;
val it = ~6 : int
- 6 + ~6;
val it = 0 : int
Integer Division
- 6 div 3;
val it = 2 : int
- 6 div 4;
val it = 0 : int
- 3 div 6;
val it = 0 : int
Integer Value Bounds
Us...
Real Number Basics
- 6.0;
val it = 6.0 : real
- ~6.0;
val it = ~6.0 : real
- 6.0 + ~6.0;
val it = 0.0 : real
- 6.0 / 3.0;
val it = 2.0 : real
- 4.0 / 6.0;
val it = 0.666666666667 : real
Real Value Bounds
Using Real Basis Library Functions
- Real.maxFinite;
val it = 1.79769313486E308 ...
Rounding
Values midway between two integers go toward the nearest even value.
- round(4.5);
val it = 4 : int
- round(3.5);
val it = 4 : int
Truncation
val it = 4 : int
- trunc(4.5);
val it = 4 : int
- trunc(3.5);
val it = 3 : int
Floor and Ceiling
- ceil(4.5);
val it = 5 : int
- f...