---
name: "imaxdiv"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/div"
---

# imaxdiv(3)

return quotient and remainder from division

Part of [div(3)](/div/3.md).

## NAME

**div**, **ldiv**, **lldiv**, **imaxdiv** – return quotient and remainder from division

## SYNOPSIS

Standard C Library (libc, -lc)

**#include \<stdlib.h\>**

*div\_t*\

**div**(*int numer*, *int denom*);

*ldiv\_t*\

**ldiv**(*long numer*, *long denom*);

*lldiv\_t*\

**lldiv**(*long long numer*, *long long denom*);

**#include \<inttypes.h\>**

*imaxdiv\_t*\

**imaxdiv**(*intmax\_t numer*, *intmax\_t denom*);

## DESCRIPTION

The **div**(), **ldiv**(), **lldiv**(), and **imaxdiv**() functions compute the value of *numer* (the numerator) divided by *denom* (the denominator) and return the stored result in the form of the *div\_t*, *ldiv\_t*, *lldiv\_t*, or *imaxdiv\_t* types, respectively. These types are structs which contain two *int*, *long*, *long* *long*, or *intmax\_t* members named *quot* (the quotient) and *rem* (the remainder).

## STANDARDS

The **div**(), **ldiv**(), **lldiv**(), and **imaxdiv**() functions conform to ISO/IEC 9899:2024 (“ISO C23”) and IEEE Std 1003.1-2024 (“POSIX.1”).

## HISTORY

The **div**() and **ldiv**() functions first appeared in 4.3BSD. The **lldiv**() and **imaxdiv**() functions first appeared in FreeBSD 5.0.
