The decimal part of the CINT is carried in excess of 0.5.
Example: CINT (2.51) = 3 CINT (-2.51) =-3
All parts less than or equal to 0.5 are removed, regardless of positive or negative
Example: CINT (2.49) = 2 CINT (-2.49) =-2
CINT (2.5) = 2 CINT (-2.5) =-2
Int is the largest integer smaller than this number.
For example:
INT (2.49) = 2 int (2.50) = 2 int (2.51) = 2
INT (-2.49) =-3 int (-2.50) =-3 int (-2.51) =-3
After the number of reserved digits is determined by round
For example:
Round (2.459, 2) = 2.46
Round (2.454, 2) = 2.45
Round (-2.459) =-2.46
Round (-2.454, 2) =-2.45
The fix skips the decimal point, that is, the decimal point is taken directly.
For example
Fix (2.51) = 2 fix (2.49) = 2
Fix (-2.49) =-2 fix (-2.51) =-2
Verify in practice:
Private sub commandementclick ()
List1.additem "CINT (2.49) =" & CSTR (CINT (2.49 ))
List1.additem "CINT (-2.49) =" & CSTR (CINT (-2.49 ))
List1.additem "CINT (2.50) =" & CSTR (CINT (2.5 ))
List1.additem "CINT (-2.50) =" & CSTR (CINT (-2.5 ))
List1.additem "CINT (2.12) =" & CSTR (CINT (2.12 ))
List1.additem "CINT (-2.12) =" & CSTR (CINT (-2.12 ))
List1.additem "CINT (2.51) =" & CSTR (CINT (2.51 ))
List1.additem "CINT (-2.51) =" & CSTR (CINT (-2.51 ))
List1.additem ""
List1.additem "int (2.49) =" & CSTR (INT (2.49 ))
List1.additem "int (-2.49) =" & CSTR (INT (-2.49 ))
List1.additem "int (2.50) =" & CSTR (INT (2.5 ))
List1.additem "int (-2.50) =" & CSTR (INT (-2.5 ))
List1.additem "int (2.12) =" & CSTR (INT (2.12 ))
List1.additem "int (-2.12) =" & CSTR (INT (-2.12 ))
List1.additem "int (2.51) =" & CSTR (INT (2.51 ))
List1.additem "int (-2.51) =" & CSTR (INT (-2.51 ))
List1.additem "int (-0.51) =" & CSTR (INT (-0.51 ))
List1.additem "int (0.51) =" & CSTR (INT (0.51 ))
List1.additem ""
List1.additem "round (2.459, 2) =" & CSTR (round (2.459, 2 ))
List1.additem "round (-2.459, 2) =" & CSTR (round (-2.459, 2 ))
List1.additem "round (2.454, 2) =" & CSTR (round (2.454, 2 ))
List1.additem "round (-2.454, 2) =" & CSTR (round (-2.454, 2 ))
List1.additem ""
List1.additem "Fix (2.45) =" & CSTR (fix (2.45 ))
List1.additem "Fix (2.51) =" & CSTR (fix (2.51 ))
List1.additem "Fix (-2.49) =" & CSTR (fix (-2.49 ))
List1.additem "Fix (-2.51) =" & CSTR (fix (-2.51 ))
End sub