Return to Snippet

Revision: 758
at August 3, 2006 20:39 by yuconner


Updated Code
#include "math.h"

#define round(x) (x<0?ceil((x)-0.5):floor((x)+0.5))
//or
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

Revision: 757
at August 3, 2006 20:33 by yuconner


Initial Code
#include "math.h"

#define round(x) (x<0?ceil((x)-0.5):floor((x)+0.5))
//or
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

Initial URL

                                

Initial Description

                                

Initial Title
integer round function macro

Initial Tags
math

Initial Language
C++