Double to int?
C / C++ / MFC
3
Posts
3
Posters
0
Views
1
Watching
-
try floor(dValue + 0.5) for positive values
-
Hello, maybe it will be useful for you to know a little bit more about this: double val1 = floor( 2.3 + 0.5 ); double val2 = floor( -2.3 + 0.5 ); double val3 = ceil( 2.3 + 0.5 ); double val4 = ceil( -2.3 + 0.5 ); printf( "%f, %f, %f, %f\r\n", val1, val2, val3, val4 ); will give you: 2.000000, -2.000000, 3.000000, -1.000000 Cheers, Marcello