unit math

Additional mathematical routines

author: Tomasz Biela (Tebe)


http://www.freepascal.org/docs-html/rtl/math/index-5.html

Constants:

name:value:description:
a0D_PI_2
a1-0.212
a20.074
a3-0.019

Interface:

name:description:
DegNormalize

function DegNormalize(deg : real) : real;



    degtorad

    function degtorad(deg : real) : real;



      radtodeg

      function radtodeg(rad : real) : real;



        gradtorad

        function gradtorad(grad : real) : real;



          radtograd

          function radtograd(rad : real) : real;



            degtograd

            function degtograd(deg : real) : real;



              gradtodeg

              function gradtodeg(grad : real) : real;



                cycletorad

                function cycletorad(cycle : real) : real;



                  radtocycle

                  function radtocycle(rad : real) : real;



                    DivMod

                    procedure DivMod(Dividend: integer; Divisor: Word; var r, Remainder: Word); overload;



                      DivMod

                      procedure DivMod(Dividend: integer; Divisor: Word; var r, Remainder: smallint); overload;



                        InRange

                        function InRange(const AValue, AMin, AMax: byte): Boolean; overload;


                        Check whether value is in range
                          InRange

                          function InRange(const AValue, AMin, AMax: Integer): Boolean; overload;



                            EnsureRange

                            function EnsureRange(const AValue, AMin, AMax: byte): Integer; overload;


                            Change value to it falls in specified range
                              EnsureRange

                              function EnsureRange(const AValue, AMin, AMax: Integer): Integer; overload;



                                Min

                                function Min(x, y: real): real; overload;


                                Return smallest of two values
                                  Min

                                  function Min(x, y: integer): integer; overload;



                                    Max

                                    function Max(x, y: real): real; overload;


                                    Return largest of two values
                                      Max

                                      function Max(x, y: integer): integer; overload;



                                        RandomRange

                                        function RandomRange(const aFrom, aTo: smallint): smallint;



                                          RandomRangeF

                                          function RandomRangeF(const min, max: single): single;



                                            RandG

                                            function RandG(mean, stddev : single) : single;


                                            Return gaussian distributed random number
                                              power

                                              function power(base : real; const exponent : shortint) : real; overload;


                                              Return real power
                                              https://github.com/graemeg/freepascal/blob/master/rtl/objpas/math.pp
                                                power

                                                function power(base : single; const exponent : shortint) : single; overload;


                                                Return real power
                                                https://github.com/graemeg/freepascal/blob/master/rtl/objpas/math.pp
                                                  power

                                                  function power(base : integer; const exponent : shortint) : integer; overload;


                                                  Return real power
                                                  https://github.com/graemeg/freepascal/blob/master/rtl/objpas/math.pp
                                                    arctan2

                                                    function arctan2(y,x : real) : real;



                                                      ArcSin

                                                      function ArcSin(x: real): real;



                                                        ArcCos

                                                        function ArcCos(x: real): real;



                                                          Tan

                                                          function Tan(x: Real): Real;



                                                            Ceil

                                                            function Ceil(a: real): smallint;



                                                              Floor

                                                              function Floor(a: real): smallint;



                                                                FMod

                                                                function FMod(a, b: real): real;



                                                                  Log10

                                                                  function Log10(x: single): single;



                                                                    log2

                                                                    function log2(x : single) : single;



                                                                      logn

                                                                      function logn(n,x : single) : single;



                                                                        IsNan

                                                                        function IsNan(const d : Single): Boolean;



                                                                          Sign

                                                                          function Sign(const AValue: Integer): shortint; overload;



                                                                            Sign

                                                                            function Sign(const AValue: Real): Real; overload;



                                                                              Sign

                                                                              function Sign(const AValue: Single): Single; overload;