beautypg.com

Ldiv, Ldiv log – Zilog Z8F0130 User Manual

Page 470

background image

Appendix B. C Standard Library

UM013037-1212

446

Zilog Developer Studio II – Z8 Encore!
User Manual

Example

double x=1.235

int exp=2;

double y;

y=ldexp(x,exp);

ldiv

Computes the quotient and remainder of the division of the numerator

numer

by the

denominator

denom

. If the division is inexact, the sign of the quotient is that of the mathe-

matical quotient, and the magnitude of the quotient is the largest integer less than the mag-
nitude of the mathematical quotient.

Synopsis

#include

ldiv_t ldiv(long numer, long denom);

Example

long x=25000;

long y=300;

div_t t;

int q;

int r;

t=ldiv(x,y);

q=t.quot;

r=t.rem;

log

Computes the natural logarithm of x. A domain error occurs if the argument is negative. A
range error occurs if the argument is zero.

Synopsis

#include

double log(double x);

Returns

The natural logarithm.

Example

double x=2.56;

double y;

y=log(x);