Chapter 13
The MATH unit

This chapter describes the math unit. The math unit was initially written by Florian Klämpfl. It provides mathematical functions which aren’t covered by the system unit.

This chapter starts out with a definition of all types and constants that are defined, after which an overview is presented of the available functions, grouped by category, and the last part contains a complete explanation of each function.

The following things must be taken into account when using this unit:

  1. This unit is compiled in Object Pascal mode so all integers are 32 bit.
  2. Some overloaded functions exist for data arrays of integers and floats. When using the address operator (@) to pass an array of data to such a function, make sure the address is typecasted to the right type, or turn on the ’typed address operator’ feature. failing to do so, will cause the compiler not be able to decide which function you want to call.

 13.1 Constants and types
 13.2 Function list by category
   Min/max determination
   Angle conversion
   Trigoniometric functions
   Hyperbolic functions
   Exponential and logarithmic functions
   Number converting
   Statistical functions
   Geometrical functions
 13.3 Functions and Procedures
   arccos
   arcosh
   arcsin
   arctan2
   arsinh
   artanh
   ceil
   cosh
   cotan
   cycletorad
   degtograd
   degtorad
   floor
   frexp
   gradtodeg
   gradtorad
   hypot
   intpower
   ldexp
   lnxp1
   log10
   log2
   logn
   max
   maxIntValue
   maxvalue
   mean
   meanandstddev
   min
   minIntValue
   minvalue
   momentskewkurtosis
   norm
   popnstddev
   popnvariance
   power
   radtocycle
   radtodeg
   radtograd
   randg
   sincos
   sinh
   stddev
   sum
   sumofsquares
   sumsandsquares
   tan
   tanh
   totalvariance
   variance