---
name: "IM_RINT"
section: "3"
platform: "linux"
package: "libvips-dev"
version: "7.14.5-1"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/IM_RINT"
---

# IM\_RINT(3)

misc math macros

## NAME

IM\_RINT, IM\_MAX, IM\_MIN - misc math macros

## SYNOPSIS

**#include \<vips/vips.h\>**

int IM\_RINT( float )\
 any IM\_MAX( any, any )\
 any IM\_MIN( any, any )

## DESCRIPTION

These macros provide some simple but fast math functions --- [IM\_MAX(3)](/IM_MAX/3.md) returns the maximum of its two arguments, [IM\_MIN(3)](/IM_MIN/3.md) the smallest, and [IM\_RINT(3)](/IM_RINT/3.md) rounds a float or double to the nearest integer.

Beware: these macros may evaluate their argument more than once, so you MUST NOT use ++,--, or a function call in their argument lists.

They are defined as:

  \#define IM\_MAX(A,B) ((A)\>(B)?(A):(B))\
   \#define IM\_MIN(A,B) ((A)\<(B)?(A):(B))\
   \#define IM\_RINT(R) ((int)((R)\>0?((R)+0.5):((R)-0.5)))

## COPYRIGHT

National Gallery, 1993

## SEE ALSO

[im\_malloc(3)](/im_malloc/3.md), [im\_open\_local(3)](/im_open_local/3.md).

## AUTHOR

J. Cupitt - 23/7/93
