·  Home
+   man pages
 -> Linux -> FreeBSD -> OpenBSD -> NetBSD -> Tru64 Unix -> HP-UX 11i -> IRIX
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

man pages->IRIX man pages -> div (3c)
 Title
 Content
 Arch
 Section All Sections 1 - General Commands 2 - System Calls 3 - Subroutines 4 - Special Files 5 - File Formats 6 - Games 7 - Macros and Conventions 8 - Maintenance Commands 9 - Kernel Interface n - New Commands

### Contents

```
DIV(3C)								       DIV(3C)

```

### NAME[Toc][Back]

```     div, ldiv - perform integer division
```

### SYNOPSIS[Toc][Back]

```     #include <stdlib.h>

div_t div (int numer, int denom);

ldiv_t ldiv (long int numer, long int denom);
```

### DESCRIPTION[Toc][Back]

```     div and ldiv compute the quotient and remainder resulting from the
division of the integer dividend numer by the integer divisor denom.  If
the division is inexact, the quotient will	be the nearest integer with
less magnitude than the algebraic quotient	(e.g., div(5/2)	yields 2, and
div(-5/2) yields -2).

div operates on and returns int quantities. ldiv operates on and returns
long int quantities.

Unless the	result cannot be represented, div and ldiv return the result
in	a structure (div_t for div, ldiv_t for ldiv) which has two integer
members: the quotient, quot, and the remainder, rem.  These members are
of	type int for div, and long int for ldiv.
```

### DIAGNOSTICS[Toc][Back]

```     If	div or ldiv is invoked with a zero denom, the same integer divide-byzero
trap occurs as if the	integer	division had occurred in-line.

PPPPaaaaggggeeee 1111```
[ Back ]
Similar pages
 Name OS Title div Linux computes the quotient and remainder of integer division ldiv Linux computes the quotient and remainder of long integer division. m_out Tru64 Perform multiple precision integer arithmetic madd Tru64 Perform multiple precision integer arithmetic itom Tru64 Perform multiple precision integer arithmetic invert Tru64 Perform multiple precision integer arithmetic mout Tru64 Perform multiple precision integer arithmetic gcd Tru64 Perform multiple precision integer arithmetic fmout Tru64 Perform multiple precision integer arithmetic fmin Tru64 Perform multiple precision integer arithmetic