Standard C Functions


ldiv (_nldiv)


Syntax

#include <stdlib.h>
ldiv_t ldiv(long number, long denom);

Arguments

number      number to be divided
denom       number to divide with

Return Value

Returns the ldiv_t type structure

Description

It divides the argument number by the argument denom, and returns the ldiv_t structure which consists of the quotient and remainder.

The code for the quotient is the same as the code for the arithmetic quotient. The absolute value of the quotient is the largest interger which is smaller than the absolute value of the arithmetic quotient (see note, below).

Note:

ldiv of N64 OS does not return correct values when number is positive and denom is negative. If there is a possibility that demon will become negative, use _nldiv.


Revision History

6/1/99 Although it was not released because the function already existed in N64 OS, changed ldiv in nustd library to _nldiv

6/2/99 Added description and note