HP SunSoft Pascal 4.0 User Manual

Page 264

Advertising
background image

240

Pascal 4.0 User’s Guide

11

Division by zero

—The divisor is zero, and the dividend is a finite non-zero

number; or, more generally, an exact infinite result is delivered by an
operation on finite operands.

Overflow

—The correctly rounded result is larger than the largest number in

the required precision.

Underflow

—The number is too small, or precision is lost, and no signal

handler is established for underflow.

Inexact

—The rounded result of a valid operation is different from the

infinitely precise result. This exception occurs whenever there is untrapped
overflow or untrapped underflow.

Math Library Exception-Handling Function:

matherr()

Some

libm

functions are specified to call

matherr()

when an exception is

detected. You can redefine

matherr()

by including a function named

matherr()

in the program. When an exception occurs, a pointer to the

exception structure,

exc

, is passed to the user-supplied

matherr()

function.

This structure, defined in the

math_p.h

header file, is as follows:

The element kind is an integer constant that describes the type of exception
that occurred, and is one of the following constants. These constants are
defined in the header file.

type

exception = record

kind: integer;

name: ^string;

arg1: double;

arg2: double;

retval: double;

end;

Advertising