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 BCD Math

DEFINITION MODULE LongBCDMath;

(* Mathematical Constants and Functions for Type LONGBCD *)

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

PROCEDURE sgn ( b : LONGBCD ) : LONGBCD;
(* Returns the signum value of b. *)

PROCEDURE floor ( b : LONGBCD ) : LONGBCD;
(* Returns the floor value of b. *)

PROCEDURE ceil ( b : LONGBCD ) : LONGBCD;
(* Returns the ceiling value of b. *)

PROCEDURE frac ( b : LONGBCD ) : LONGBCD;
(* Returns the fractional part of b. *)

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

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

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

PROCEDURE sqrt ( b : LONGBCD ) : LONGBCD;
(* Returns the square root of b. *)

PROCEDURE ln ( b : LONGBCD ) : LONGBCD;
(* Returns the natural logarithm of b. *)

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

PROCEDURE sin ( b : LONGBCD ) : LONGBCD;
(* Returns the sine of b. *)

PROCEDURE cos ( b : LONGBCD ) : LONGBCD;
(* Returns the cosine of b. *)

PROCEDURE tan ( b : LONGBCD ) : LONGBCD;
(* Returns the tangent of b. *)

PROCEDURE arcsin ( b : LONGBCD ) : LONGBCD;
(* Returns the arcsine of b. *)

PROCEDURE arccos ( b : LONGBCD ) : LONGBCD;
(* Returns the arccosine of b. *)

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

END LongBCDMath.