Site Menu Project Specification Implementation Recommendations Reference Needs Updating Work in Progress Wastebasket Wiki Manual |
BCD MathSpec.BCDMath HistoryHide minor edits - Show changes to output 2010-01-13 16:09
by - changed entier to floor
Changed lines 13-14 from:
PROCEDURE (* Returns the to:
PROCEDURE floor( r : BCD ) : BCD; (* Returns the floor value of r. *) 2010-01-13 14:56
by - removed abs because ABS is a pervasive function
Deleted lines 8-10:
PROCEDURE abs( r : BCD ) : BCD; (* Returns the absolute value of r. *) 2010-01-13 14:16
by -
Added lines 1-61:
[@DEFINITION MODULE BCDMath; (* Mathematical constants and functions *) CONST E = 2.7182818284590452353602874713526; PI = 3.1415926535897932384626433832795; PHI = 1.6180339887498948482045868343656; PROCEDURE abs( r : BCD ) : BCD; (* Returns the absolute value of r. *) PROCEDURE sgn( r : BCD ) : BCD; (* Returns the signum value of r. *) PROCEDURE entier( r : BCD ) : BCD; (* Returns the entier or floor value of r. *) PROCEDURE ceil( r : BCD ) : BCD; (* Returns the ceiling value of r. *) PROCEDURE frac( r : BCD ) : BCD; (* Returns the fractional part of r. *) PROCEDURE trunc( r : BCD; n : CARDINAL ) : BCD; (* Returns the value of r truncated to n decimal places after the decimal point. *) PROCEDURE round( r : BCD; n : CARDINAL ) : BCD; (* Returns the value of r rounded to n decimal places after the decimal point. *) PROCEDURE power( base, exponent : BCD ) : BCD; (* Returns the value of base raised to the power of exponent. *) PROCEDURE sqrt( r : BCD ) : BCD; (* Returns the square root of r. *) PROCEDURE ln( r : BCD ) : BCD; (* Returns the natural logarithm of r. *) PROCEDURE log( r : BCD ) : BCD; (* Returns the decimal logarithm of r. *) PROCEDURE sin( r : BCD ) : BCD; (* Returns the sine of r. *) PROCEDURE cos( r : BCD ) : BCD; (* Returns the cosine of r. *) PROCEDURE tan( r : BCD ) : BCD; (* Returns the tangent of r. *) PROCEDURE arcsin( r : REAL ) : REAL; (* Returns the arcsine of r. *) PROCEDURE arccos( r : BCD ) : BCD; (* Returns the arccosine of r. *) PROCEDURE arctan( r : BCD ) : BCD; (* Returns the arctangent of r. *) END BCDMath.@] |