Modula-2 Reloaded

A Modern Typesafe & Literate Programming Notation

Site Menu

Project

Specification

Implementation

Recommendations

Reference

Needs Updating

Work in Progress

Wastebasket

Wiki Manual

edit SideBar

Long Real Math

DEFINITION MODULE LongRealMath;

(* Mathematical Constants and Functions for Type LONGREAL *)

CONST
    E = 2.7182818284590452353602874713526;
    PI = 3.1415926535897932384626433832795;
    PHI = 1.6180339887498948482045868343656;

PROCEDURE sgn ( r : LONGREAL ) : LONGREAL;
(* Returns the signum value of r. *)

PROCEDURE floor ( r : LONGREAL ) : LONGREAL;
(* Returns the floor value of r. *)

PROCEDURE ceil ( r : LONGREAL ) : LONGREAL;
(* Returns the ceiling value of r. *)

PROCEDURE frac ( r : LONGREAL ) : LONGREAL;
(* Returns the fractional part of r. *)

PROCEDURE trunc ( r : LONGREAL; n : CARDINAL ) : LONGREAL;
(* Returns the value of r truncated to n decimal places. *)

PROCEDURE round ( r : LONGREAL; n : CARDINAL ) : LONGREAL;
(* Returns the value of r rounded to n decimal places. *)

PROCEDURE power ( base, exponent : LONGREAL ) : LONGREAL;
(* Returns the value of base raised to the power of exponent. *)

PROCEDURE sqrt ( r : LONGREAL ) : LONGREAL;
(* Returns the square root of r. *)

PROCEDURE ln ( r : LONGREAL ) : LONGREAL;
(* Returns the natural logarithm of r. *)

PROCEDURE log ( r : LONGREAL ) : LONGREAL;
(* Returns the decimal logarithm of r. *)

PROCEDURE sin ( r : LONGREAL ) : LONGREAL;
(* Returns the sine of r. *)

PROCEDURE cos ( r : LONGREAL ) : LONGREAL;
(* Returns the cosine of r. *)

PROCEDURE tan ( r : LONGREAL ) : LONGREAL;
(* Returns the tangent of r. *)

PROCEDURE arcsin ( r : LONGREAL ) : LONGREAL;
(* Returns the arcsine of r. *)

PROCEDURE arccos ( r : LONGREAL ) : LONGREAL;
(* Returns the arccosine of r. *)

PROCEDURE arctan ( r : LONGREAL ) : LONGREAL;
(* Returns the arctangent of r. *)

END LongRealMath.