I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
Index »

john\′s Photo
15 Nov 07, 1:11PM
(1 reply)
Does this work on all platforms?
will\′s Photo
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;
}
Currently you need to be logged in to leave a message.