Charm Maths Library (maths) 

The maths library contains procedures for performing maths operations. It also contains the following function record (precision is extended unless using the VFP co-processor when it is double):


 real functions

Get random number

export proc random () int

  • returns random number
  1. Use modulo and base addition to limit the returned value to a number range.


The following procedures work on real values to return the values of mathematical functions (all angles in radians), or convert real numbers between native and packed formats:

 Absolute value

ref proc (real |argument|) real abs;

  • passed argument- argument
  • returns absolute value of argument

Integer value

ref proc (real |argument|) real rnd;

  • passed argument- argument
  • returns integer value of argument

Square root

ref proc (real |argument|) real sqrt;

  • passed argument- argument
  • returns square root of argument

Natural logarithm

ref proc (real |argument|) real lgn;

  • passed argument- argument
  • returns natural logarithm of argument

Logarithm base 10

ref proc (real |argument|) real log;

  • passed argument- argument
  • returns logarithm base 10 of argument


ref proc (real |argument|) real exp;

  • passed argument- argument
  • returns exponential value of argument


ref proc (real |argument|) real sin;

  • passed argument- argument
  • returns sine of argument


ref proc (real |argument|) real cos;

  • passed argument- argument
  • returns cosine of argument


ref proc (real |argument|) real tan;

  • passed argument- argument
  • returns tangent of argument

Arc sine

ref proc (real |argument|) real asn;

  • passed argument- argument
  • returns arc sine of argument

Arc cosine

ref proc (real |argument|) real acs;

  • passed argument- argument
  • returns arc cosine of argument

Arc tangent

ref proc (real |argument|) real atn;

  • passed argument- argument
  • returns arc tangent of argument


ref proc (real |a1|, real |a2|) real pow;

  • passed a1- argument 1
  •             a2- argument 2
  • returns a1 to the power of a2

Polar angle

ref proc (real |argument|) real pol;

  • passed argument- argument
  • returns polar angle of argument


Make a Free Website with Yola.