Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Why use int instead of float to average three numbers in python?
Why use int instead of float to average three numbers in python?
Int prevents the plastic from overflowing.

Int subtracts the smaller number from the larger number and then divides it by 2 to get the average value of two numbers added to the smaller number, which well prevents the problem of plastic overflow.

Float divides the binary bits of two numbers into the same part and different parts, calculates the average value of the same part through bitwise summation, then calculates the average value of different parts through XOR, and the average values of the two numbers are added.