in reply to Re: Rounding error?
in thread Rounding error?
This rule has its formal name, called "round to even".
UpdateSorry, I didn't notice that bmann already mentioned this term in his post ;-)
Update 2To support what bmann said below, I tried this c code, regardless whether I define i as float or double, the round to even rule does apply. The c compiler I used is borland c 5.5, my PC is windows XP.
#include <stdio.h> #include <stdlib.h> int main(int argc, char * * argv) { for (double i=0; i < 10; i += .5) { printf("%.1f: %.0f\n", i, i); } return 0; }
|
|---|