beautypg.com

Sqrt, Srand, Sqrt srand – Zilog Z8F0130 User Manual

Page 487

background image

UM013037-1212

sqrt

Zilog Developer Studio II – Z8 Encore!

User Manual

463

Synopsis

#include

int sprintf(char *s, char *format, ...);

Returns

The number of characters written in the array, not counting the terminating null character.

Example

int d=51;

char buf [40];

sprint(buf,"COMPASS/%d",d);

sqrt

Computes the nonnegative square root of x. A domain error occurs if the argument is neg-
ative.

Synopsis

#include

double sqrt(double x);

Returns

The value of the square root.

Example

double x=25.0;

double y;

y=sqrt(x);

srand

Uses the argument as a seed for a new sequence of pseudorandom numbers to be returned
by subsequent calls to

rand

. If

srand

is then called with the same seed value, the

sequence of pseudorandom numbers is repeated. If

rand

is called before any calls to

srand

have been made, the same sequence is generated as when

srand

is first called with

a seed value of 1.

Synopsis

#include

void srand(unsigned int seed);