28.06.2013 Views

ISO Pascal reference manual

ISO Pascal reference manual

ISO Pascal reference manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

*Execution error -- significance lost<br />

Appendix C<br />

The trigonometric functions are most accurate when their arguments are in<br />

the primary range ( about -PI..PI ). The further the argument gets from this<br />

range the less accurate is the result. The error indicates that the argument<br />

was too far from the primary range that the result is likely to be so<br />

inaccurate as to be meaningless.<br />

PROGRAM error(output);<br />

VAR s, a : real;<br />

n : integer;<br />

BEGIN<br />

a := 1;<br />

FOR n := 1 TO 1000 DO BEGIN<br />

a := 2*a;<br />

s := SIN(a); (should fail eventually}<br />

END;<br />

writeln('Error not detected');<br />

END.<br />

*Execution error -- not enough store<br />

The program has requested more working memory than is available. The<br />

common causes for this error are either declaring enormous arrays or<br />

calling procedures or functions recursively without a suitable termination<br />

condition. Note that arrays of arrays can use up space very quickly.<br />

PROGRAM error(output);<br />

[Note that this program could just blow up if}<br />

(the compiler's check for running out of store}<br />

(fails to catch the error}<br />

PROCEDURE recurse(n : integer);<br />

BEGIN<br />

IF n > 0 THEN recurse(n+1);<br />

END;<br />

BEGIN<br />

recurse(1); [this will never come back}<br />

END.<br />

<strong>Pascal</strong> Issue 1 105

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!