Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Why is C language Double (9/2) equal to 4?
Why is C language Double (9/2) equal to 4?
Because 9/2 = 4, twice as much as 4 is still 4. The method of the program is not an ordinary division, but a so-called division. If double type is used, it is the "integer" division of double. It's good to understand it this way. The/method here is never an accurate division in mathematics, and there will always be some small errors. Especially the division after the decimal point and the conversion between decimal and binary make the/method not simply equal to the division in mathematics.