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:
ArcCos

function ArcCos(x: real): real;



    ArcSin

    function ArcSin(x: real): real;



      arctan2

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



        Ceil

        function Ceil(a: real): smallint;



          cycletorad

          function cycletorad(cycle : real) : real;



            DegNormalize

            function DegNormalize(deg : real) : real;



              degtograd

              function degtograd(deg : real) : real;



                degtorad

                function degtorad(deg : 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;



                      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;



                          Floor

                          function Floor(a: real): smallint;



                            FMod

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



                              gradtodeg

                              function gradtodeg(grad : real) : real;



                                gradtorad

                                function gradtorad(grad : real) : real;



                                  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;



                                      IsNan

                                      function IsNan(const d : Single): Boolean;



                                        Log10

                                        function Log10(x: single): single;



                                          log2

                                          function log2(x : single) : single;



                                            logn

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



                                              Max

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


                                              Return largest of two values
                                                Max

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



                                                  Min

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


                                                  Return smallest of two values
                                                    Min

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



                                                      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
                                                            radtocycle

                                                            function radtocycle(rad : real) : real;



                                                              radtodeg

                                                              function radtodeg(rad : real) : real;



                                                                radtograd

                                                                function radtograd(rad : real) : real;



                                                                  RandG

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


                                                                  Return gaussian distributed random number
                                                                    RandomRange

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



                                                                      RandomRangeF

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



                                                                        Sign

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



                                                                          Sign

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



                                                                            Sign

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



                                                                              Tan

                                                                              function Tan(x: Real): Real;