Does this work on all platforms?
15 Nov 07, 5:24PM
Round doesn't work with Microsoft Visual Studio, and I suspect it probably doesn't work with many other Windows C++ compilers (i.e. I can't find it in the Borland C manual).
Simple though to replicate with the reference:floor command, i.e. <tt>round(x) == floor(x+0.5)</tt>.
Heres an example for MS Visual Studio, for a Win32 console project:
#include "stdafx.h" #include <math.h> #include <stdio.h> int _tmain(int argc, _TCHAR* argv[]) { for(double a=12;a<13;a+=0.1) printf("round of %.1lf is %.1lf\n", a, floor(a+0.5)); return 0; }
Login