Extended Math Unit

Download math.zip (1341 bytes)

This is a simple extension of TP's math interface. It is much faster and safer than using the functions that come with Turbo Pascal. I use them a lot, so I put them in their own seperate unit....


{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=-=-=-                                                     -=-=-=-=-=-=
-=-=-=                       Extended Math Unit                        =-=-=-
=-=-                                                                     -=-=
-=-=-=                     Coded by: Chris Lattner                     -=-=-=
=-=-=-=-=-=-                        1995                         -=-=-=-=-=-=
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

UNIT Math;

INTERFACE
FUNCTION  Tan(Angle : REAL) : REAL;
(*  Tan - Simple complement to Sin and Cos functions.  Angle is in Radians *)

FUNCTION  Sqrt(Square : LONGINT) : WORD;
(*  Sqrt - FAST integer square root routine.  Self explanitory.            *)

PROCEDURE SeedRand;
(*  SeedRand - Seeds the random number generator with the timer.           *)

FUNCTION  Rand(Range : WORD) : WORD;
(*  Rand - Replacement for TP's Random function.  Much faster and reliable *)


  • Created by Chris Lattner 1995