1MACROS(3) Library Functions Manual MACROS(3)
2
3
4
6 IM_RINT, IM_MAX, IM_MIN - misc math macros
7
9 #include <vips/vips.h>
10 #include <vips/util.h>
11
12 int IM_RINT( float )
13 any IM_MAX( any, any )
14 any IM_MIN( any, any )
15
16
18 These macros provide some simple but fast math functions --- IM_MAX(3)
19 returns the maximum of its two arguments, IM_MIN(3) the smallest, and
20 IM_RINT(3) rounds a float or double to the nearest integer.
21
22 Beware: these macros may evaluate their argument more than once, so you
23 MUST NOT use ++,--, or a function call in their argument lists.
24
25 They are defined as:
26
27 #define IM_MAX(A,B) ((A)>(B)?(A):(B))
28 #define IM_MIN(A,B) ((A)<(B)?(A):(B))
29 #define IM_RINT(R) ((int)((R)>0?((R)+0.5):((R)-0.5)))
30
31
33 National Gallery, 1993
34
36 im_malloc(3), im_open_local(3), `VIPS Library Programmers' Guide' in
37 accompanying documentation.
38
40 J. Cupitt - 23/7/93
41
42
43
44 11 April 1990 MACROS(3)