Round (X,[n]) rounding n reserved fractional number
1, when n is not filled, the default is 0, that is, the decimal part is not retained
A, when the fractional part is only 0.5 when the integer part if it is an odd number in 1, if even the fractional part of the
Print (round (1.5)) #2 fractional part is divided into 0.5 integers with an odd number +1
Print (round (2.5)) #2 fractional part is divided into 0.5 integer parts for even number of fractional part
Print (Round (-1.5)) #-2
Print (Round (-2.5)) #-2
Print (round (1.4)) #1
Print (Round (2.4)) #2
Print (Round (-1.4)) #-1
Print (Round (-2.4)) #-2
b, the number of parts is not 0.5 when you press rounding
Print (round (1.54)) #2 decimal 0.54 in 1
Print (round (2.54)) #3
Print (Round (-1.54)) #-2
Print (Round (-2.54)) #-3
Print (Round (1.45)) #1 decimal 0.45
Print (round (2.45)) #2
Print (Round (-1.45)) #-1
Print (Round (-2.45)) #-2
2. When the fractional part is reserved
A, when the fractional part of the position after the number of a 5 o'clock, the number of positions to retain the number of even when 1, odd to go
Print (Round (2.635, 2)) #2.63 the number of reserved digits after a 5, the reserved position is 3 is odd, then does not enter 1
Print (Round (2.645, 2)) #2.65 the number of reserved digits is 5, the reserved position is 4 is even, then the 1
Print (Round (2.655, 2)) #2.65
Print (Round (2.665, 2)) #2.67
Print (Round (2.675, 2)) #2.67
b, when the number of positions after the one is not 5 o'clock, press rounding
Print (Round (2.636, 2)) #2.64
Print (Round (2.646, 2)) #2.65
Print (Round (2.656, 2)) #2.66
Print (Round (2.666, 2)) #2.67
Print (Round (2.676, 2)) #2.68
Http://www.cnblogs.com/liujinxin/p/6121509.html
Use of round (x,[n]) in Python