Macros "round(x)"
Join the DZone community and get the full member experience.
Join For Free// macros "round(x)"
#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))
Macro (computer science)
Opinions expressed by DZone contributors are their own.
Comments