beautypg.com

Ieee support functions – HP SunSoft Pascal 4.0 User Manual

Page 260

background image

236

Pascal 4.0 User’s Guide

11

The following Pascal program is an example of how to use math functions.

IEEE Support Functions

This section describes the IEEE support functions, including

ieee_functions()

,

ieee_values()

, and

ieeee_retrospective()

.

program TestLibm(output);

#include

var

d0,d1,d2: double;

f0,f1,f2: single;

begin

d0 := 0.0; d1 := 1.0; d2 := 2.0;

f0 := 0.0; f1 := 1.0; f2 := 2.0;

writeln('Trigonometric functions');

writeln(sin(d0));

writeln(sinf(f0));

sincos(M_PI_2, d1, d2);

writeln(d1, d2);

sincosf(M_PI_2, f1, f2);

writeln(f1, f2);

writeln('Exponential, logarithm, power');

writeln(exp(d1));

writeln(log(d1));

writeln(pow(d1, d1));

writeln(expf(f1));

writeln(logf(f1));

writeln(powf(f1, f1));

end.