Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ div(cmds) — Sprite KS.390

Media Vault

Software Library

Restoration Projects

Artifacts Sought

div  —  User Commands

NAME

div, ldiv − Return quotient and remainder from division

SYNOPSIS

#include <stdlib.h>
 div_t
div(numer, denom)
 ldiv_t
ldiv(numer, denom)

ARGUMENTS

int numer   (in) Numerator for division. 

int denom   (in) Denominator for division. 
 

DESCRIPTION

The div and ldiv procedures divide numer by denom and return both the quotient and remainder, in the quot and rem fields of the result structure.  If the division is inexact, the sign of the resulting quotient is that of the algebraic quotient, and the magnitude of the resulting quotient is the largest integer less than the magnitude of the algebraic quotient. 

Div takes int arguments and produces int results, while ldiv works with long int arguments and results. 
 

KEYWORDS

divide, quotient, remainder

Sprite version 1.0  —  March 21, 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026