Over a million developers have joined DZone.

Macros "round(x)"

·
// 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))
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}