The difference between "4 rounded to 6 to 5, odd and even" and "rounded to 5"

"4 is rounded to 6 and 5 is on par with, odd and even" I don't think it is because of the problem of floating-point numbers in the computer representation. The representation of computer floating point numbers is a standard rule defined by IEEE, and if it exists in python, it makes no sense that it does not exist in other languages. In fact, it is because the rounding method is more accurate in scientific computing than the "rounding" method of the past. The national standard has also stipulated that "4 rounding 6 to 5 equals, odd and even do not enter" instead of "rounding".

From a statistical point of view, if a large number of data are rounded without thinking, the statistical results will be too large. And "odd into even" can reduce the rounding error to a minimum.

Odd and even rounding is a more accurate and scientific counting retention method, and it is a number rounding rule.

The specific requirements are as follows (take two decimal places as an example):

  •  (1) If the last digit of the reserved number of digits is 4 or less, then discard it, for example, 5.214 with two decimal places is 5.21.
  •  (2) If the last digit of the reserved digits is 6 or more, enter it, for example, 5.216 is reserved with two decimal places as 5.22.
  •  (3) If the reserved number of digits is to reserve the integer part or to reserve one decimal place, the odd and even rounding shall be determined according to the reserved bits:
    >>> round ( 5.215 , 2 )# does not actually carry 5.21 >>> round ( 5.225 , 2 ) 5.22 >>> >>> round ( 1.5 )# carry 2 here >>> round ( 1.5 )== round ( 2.5 )#Even round off True >>> round ( 1.15 , 1 ) 1.1 >>> round ( 1.25 , 1 ) 1.2 >>> round ( 1.151
    
    
    
    
    
    
    
    
    
    
    
    
    ,1)1.2>>> round(1.251,1)1.3
    
    
    
  •  (4) If the last digit of the reserved digit is 5, and there is a digit after the digit. Then enter it, for example, 5.2152 with two decimal places is 5.22, 5.2252 with two decimal places is 5.23, and 5.22500001 with two decimal places is 5.23.
From a statistical point of view, "odd rounding" is more scientific than "rounding". In a large number of operations, it makes the mean value of the rounded result error tend to zero, instead of rounding every five like rounding, leading to the result Biased towards large numbers, the errors accumulate and then systematic errors are generated.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325347522&siteId=291194637