6.7.1. Integer Part of a Number
In a number n, the integer (or integral) part is the largest integer smaller than n. The fractional part is the difference between the integer part and n. Rounding uses the fractional part to determine the integer part. There are 9 ways to do this:
1) Ceiling - smallest integer not less than x
The ceiling of 2.1, 2.2, 2.3, 2.4, 2,5, 2.6, 2.7, 2.8, and 2.9 is 3.
2) Floor - largest integer greater than or equal to x
The floor of 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, and 2.9 is 2.
3) Half down - numbers with fractional half (0.5) are rounded down to the smallest integer less than x
2.5 is rounded down to 2; 3.5 is rounded down to 3; 4.5 is rounded down to 4 and so on.
4) Half to even - numbers with a fractional half (0.5) are rounded to the next higher or lower even integer,
5.5 is rounded to 6 while 4.5 is rounded to 4
5) Half to infinity - numbers with a fractional half are rounded to the next integer away from 0.
5.5 is rounded to 6; 4.5 is rounded to 5 while -3.5 is rounded to -4.
6) Half to odd - numbers with a fractional half are rounded to the next higher or lower odd integer,
4.5 and 5.5 are rounded to 5 and 6.5 and 7.5 are rounded to 7.
7) Half to zero - numbers with a fractional half are rounded to the next integer closer to 0.
5.5 is rounded to 5; 4.5 is rounded to 4 while -3.5 is rounded to -3.
8) Half up - the most commonly used method of rounding. Numbers with fractional halves are rounded up to the next higher integer.
2.5 is rounded 3; 4.5 is rounded to 5; 6.5 is rounded to 7 and so on.
9) Truncate - leaves only the integer part and removes the fractional part.
12.35 is truncated to 12.
1) Ceiling - smallest integer not less than x
The ceiling of 2.1, 2.2, 2.3, 2.4, 2,5, 2.6, 2.7, 2.8, and 2.9 is 3.
2) Floor - largest integer greater than or equal to x
The floor of 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, and 2.9 is 2.
3) Half down - numbers with fractional half (0.5) are rounded down to the smallest integer less than x
2.5 is rounded down to 2; 3.5 is rounded down to 3; 4.5 is rounded down to 4 and so on.
4) Half to even - numbers with a fractional half (0.5) are rounded to the next higher or lower even integer,
5.5 is rounded to 6 while 4.5 is rounded to 4
5) Half to infinity - numbers with a fractional half are rounded to the next integer away from 0.
5.5 is rounded to 6; 4.5 is rounded to 5 while -3.5 is rounded to -4.
6) Half to odd - numbers with a fractional half are rounded to the next higher or lower odd integer,
4.5 and 5.5 are rounded to 5 and 6.5 and 7.5 are rounded to 7.
7) Half to zero - numbers with a fractional half are rounded to the next integer closer to 0.
5.5 is rounded to 5; 4.5 is rounded to 4 while -3.5 is rounded to -3.
8) Half up - the most commonly used method of rounding. Numbers with fractional halves are rounded up to the next higher integer.
2.5 is rounded 3; 4.5 is rounded to 5; 6.5 is rounded to 7 and so on.
9) Truncate - leaves only the integer part and removes the fractional part.
12.35 is truncated to 12.