|
@@ -6,12 +6,14 @@ bbdoc: Math/Math
|
|
End Rem
|
|
End Rem
|
|
Module BRL.Math
|
|
Module BRL.Math
|
|
|
|
|
|
-ModuleInfo "Version: 1.07"
|
|
|
|
|
|
+ModuleInfo "Version: 1.08"
|
|
ModuleInfo "Author: Mark Sibly"
|
|
ModuleInfo "Author: Mark Sibly"
|
|
ModuleInfo "License: zlib/libpng"
|
|
ModuleInfo "License: zlib/libpng"
|
|
ModuleInfo "Copyright: Blitz Research Ltd"
|
|
ModuleInfo "Copyright: Blitz Research Ltd"
|
|
ModuleInfo "Modserver: BRL"
|
|
ModuleInfo "Modserver: BRL"
|
|
|
|
|
|
|
|
+ModuleInfo "History: 1.08"
|
|
|
|
+ModuleInfo "History: Inlined math functions."
|
|
ModuleInfo "History: 1.07"
|
|
ModuleInfo "History: 1.07"
|
|
ModuleInfo "History: Added Round and Trunc."
|
|
ModuleInfo "History: Added Round and Trunc."
|
|
ModuleInfo "History: 1.06"
|
|
ModuleInfo "History: 1.06"
|
|
@@ -19,6 +21,7 @@ ModuleInfo "History: Added Float versions."
|
|
ModuleInfo "History: 1.05 Release"
|
|
ModuleInfo "History: 1.05 Release"
|
|
ModuleInfo "History: Added IsNan and IsInf"
|
|
ModuleInfo "History: Added IsNan and IsInf"
|
|
|
|
|
|
|
|
+Import "bbMath.h"
|
|
Import "math.c"
|
|
Import "math.c"
|
|
|
|
|
|
Extern
|
|
Extern
|
|
@@ -27,193 +30,193 @@ Rem
|
|
bbdoc: Check if a value is NAN
|
|
bbdoc: Check if a value is NAN
|
|
returns: True if @x is 'not a number' (eg: Sqr(-1))
|
|
returns: True if @x is 'not a number' (eg: Sqr(-1))
|
|
End Rem
|
|
End Rem
|
|
-Function IsNan( x:Double )="bbIsNan"
|
|
|
|
|
|
+Function IsNan( x:Double )="int bbIsNan(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Check if a value is infinite (eg: 1.0/0.0)
|
|
bbdoc: Check if a value is infinite (eg: 1.0/0.0)
|
|
returns: True if @x is infinite
|
|
returns: True if @x is infinite
|
|
End Rem
|
|
End Rem
|
|
-Function IsInf( x:Double )="bbIsInf"
|
|
|
|
|
|
+Function IsInf( x:Double )="int bbIsInf(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Square root of @x
|
|
bbdoc: Square root of @x
|
|
End Rem
|
|
End Rem
|
|
-Function Sqr:Double( x:Double )="bbSqr"
|
|
|
|
|
|
+Function Sqr:Double( x:Double )="double bbSqr(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Sine of @x degrees
|
|
bbdoc: Sine of @x degrees
|
|
End Rem
|
|
End Rem
|
|
-Function Sin:Double( x:Double )="bbSin"
|
|
|
|
|
|
+Function Sin:Double( x:Double )="double bbSin(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Cosine of @x degrees
|
|
bbdoc: Cosine of @x degrees
|
|
End Rem
|
|
End Rem
|
|
-Function Cos:Double( x:Double )="bbCos"
|
|
|
|
|
|
+Function Cos:Double( x:Double )="double bbCos(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Tangent of @x degrees
|
|
bbdoc: Tangent of @x degrees
|
|
End Rem
|
|
End Rem
|
|
-Function Tan:Double( x:Double )="bbTan"
|
|
|
|
|
|
+Function Tan:Double( x:Double )="double bbTan(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Inverse Sine of @x
|
|
bbdoc: Inverse Sine of @x
|
|
End Rem
|
|
End Rem
|
|
-Function ASin:Double( x:Double )="bbASin"
|
|
|
|
|
|
+Function ASin:Double( x:Double )="double bbASin(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Inverse Cosine of @x
|
|
bbdoc: Inverse Cosine of @x
|
|
End Rem
|
|
End Rem
|
|
-Function ACos:Double( x:Double )="bbACos"
|
|
|
|
|
|
+Function ACos:Double( x:Double )="double bbACos(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Inverse Tangent of @x
|
|
bbdoc: Inverse Tangent of @x
|
|
End Rem
|
|
End Rem
|
|
-Function ATan:Double( x:Double )="bbATan"
|
|
|
|
|
|
+Function ATan:Double( x:Double )="double bbATan(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Inverse Tangent of two variables @x , @y
|
|
bbdoc: Inverse Tangent of two variables @x , @y
|
|
End Rem
|
|
End Rem
|
|
-Function ATan2:Double( y:Double,x:Double )="bbATan2"
|
|
|
|
|
|
+Function ATan2:Double( y:Double,x:Double )="double bbATan2(double,double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Hyperbolic sine of @x
|
|
bbdoc: Hyperbolic sine of @x
|
|
End Rem
|
|
End Rem
|
|
-Function Sinh:Double( x:Double )="bbSinh"
|
|
|
|
|
|
+Function Sinh:Double( x:Double )="double bbSinh(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Hyperbolic cosine of @x
|
|
bbdoc: Hyperbolic cosine of @x
|
|
End Rem
|
|
End Rem
|
|
-Function Cosh:Double( x:Double )="bbCosh"
|
|
|
|
|
|
+Function Cosh:Double( x:Double )="double bbCosh(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Hyperbolic tangent of @x
|
|
bbdoc: Hyperbolic tangent of @x
|
|
End Rem
|
|
End Rem
|
|
-Function Tanh:Double( x:Double )="bbTanh"
|
|
|
|
|
|
+Function Tanh:Double( x:Double )="double bbTanh(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Exponential function
|
|
bbdoc: Exponential function
|
|
end rem
|
|
end rem
|
|
-Function Exp:Double( x:Double )="bbExp"
|
|
|
|
|
|
+Function Exp:Double( x:Double )="double bbExp(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Natural logarithm
|
|
bbdoc: Natural logarithm
|
|
End Rem
|
|
End Rem
|
|
-Function Log:Double( x:Double )="bbLog"
|
|
|
|
|
|
+Function Log:Double( x:Double )="double bbLog(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Base 10 logarithm
|
|
bbdoc: Base 10 logarithm
|
|
End Rem
|
|
End Rem
|
|
-Function Log10:Double( x:Double )="bbLog10"
|
|
|
|
|
|
+Function Log10:Double( x:Double )="double bbLog10(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Smallest integral value not less than @x
|
|
bbdoc: Smallest integral value not less than @x
|
|
End Rem
|
|
End Rem
|
|
-Function Ceil:Double( x:Double )="bbCeil"
|
|
|
|
|
|
+Function Ceil:Double( x:Double )="double bbCeil(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Largest integral value not greater than @x
|
|
bbdoc: Largest integral value not greater than @x
|
|
End Rem
|
|
End Rem
|
|
-Function Floor:Double( x:Double )="bbFloor"
|
|
|
|
|
|
+Function Floor:Double( x:Double )="double bbFloor(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Nearest integral value to @x.
|
|
bbdoc: Nearest integral value to @x.
|
|
End Rem
|
|
End Rem
|
|
-Function Round:Double( x:Double )="bbRound"
|
|
|
|
|
|
+Function Round:Double( x:Double )="double bbRound(double)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Nearest integral not greater in magnitude than @x.
|
|
bbdoc: Nearest integral not greater in magnitude than @x.
|
|
End Rem
|
|
End Rem
|
|
-Function Trunc:Double( x:Double )="bbTrunc"
|
|
|
|
|
|
+Function Trunc:Double( x:Double )="double bbTrunc(double)!"
|
|
|
|
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Square root of @x
|
|
bbdoc: Square root of @x
|
|
End Rem
|
|
End Rem
|
|
-Function SqrF:Float( x:Float )="bbSqrf"
|
|
|
|
|
|
+Function SqrF:Float( x:Float )="float bbSqrf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Sine of @x degrees
|
|
bbdoc: Sine of @x degrees
|
|
End Rem
|
|
End Rem
|
|
-Function SinF:Float( x:Float )="bbSinf"
|
|
|
|
|
|
+Function SinF:Float( x:Float )="float bbSinf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Cosine of @x degrees
|
|
bbdoc: Cosine of @x degrees
|
|
End Rem
|
|
End Rem
|
|
-Function CosF:Float( x:Float )="bbCosf"
|
|
|
|
|
|
+Function CosF:Float( x:Float )="float bbCosf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Tangent of @x degrees
|
|
bbdoc: Tangent of @x degrees
|
|
End Rem
|
|
End Rem
|
|
-Function TanF:Float( x:Float )="bbTanf"
|
|
|
|
|
|
+Function TanF:Float( x:Float )="float bbTanf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Inverse Sine of @x
|
|
bbdoc: Inverse Sine of @x
|
|
End Rem
|
|
End Rem
|
|
-Function ASinF:Float( x:Float )="bbASinf"
|
|
|
|
|
|
+Function ASinF:Float( x:Float )="float bbASinf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Inverse Cosine of @x
|
|
bbdoc: Inverse Cosine of @x
|
|
End Rem
|
|
End Rem
|
|
-Function ACosF:Float( x:Float )="bbACosf"
|
|
|
|
|
|
+Function ACosF:Float( x:Float )="float bbACosf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Inverse Tangent of @x
|
|
bbdoc: Inverse Tangent of @x
|
|
End Rem
|
|
End Rem
|
|
-Function ATanF:Float( x:Float )="bbATanf"
|
|
|
|
|
|
+Function ATanF:Float( x:Float )="float bbATanf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Inverse Tangent of two variables @x , @y
|
|
bbdoc: Inverse Tangent of two variables @x , @y
|
|
End Rem
|
|
End Rem
|
|
-Function ATan2F:Float( y:Float,x:Float )="bbATan2f"
|
|
|
|
|
|
+Function ATan2F:Float( y:Float,x:Float )="float bbATan2f(float,float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Hyperbolic sine of @x
|
|
bbdoc: Hyperbolic sine of @x
|
|
End Rem
|
|
End Rem
|
|
-Function SinhF:Float( x:Float )="bbSinhf"
|
|
|
|
|
|
+Function SinhF:Float( x:Float )="float bbSinhf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Hyperbolic cosine of @x
|
|
bbdoc: Hyperbolic cosine of @x
|
|
End Rem
|
|
End Rem
|
|
-Function CoshF:Float( x:Float )="bbCoshf"
|
|
|
|
|
|
+Function CoshF:Float( x:Float )="float bbCoshf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Hyperbolic tangent of @x
|
|
bbdoc: Hyperbolic tangent of @x
|
|
End Rem
|
|
End Rem
|
|
-Function TanhF:Float( x:Float )="bbTanhf"
|
|
|
|
|
|
+Function TanhF:Float( x:Float )="float bbTanhf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Exponential function
|
|
bbdoc: Exponential function
|
|
end rem
|
|
end rem
|
|
-Function ExpF:Float( x:Float )="bbExpf"
|
|
|
|
|
|
+Function ExpF:Float( x:Float )="float bbExpf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Natural logarithm
|
|
bbdoc: Natural logarithm
|
|
End Rem
|
|
End Rem
|
|
-Function LogF:Float( x:Float )="bbLogf"
|
|
|
|
|
|
+Function LogF:Float( x:Float )="float bbLogf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Base 10 logarithm
|
|
bbdoc: Base 10 logarithm
|
|
End Rem
|
|
End Rem
|
|
-Function Log10F:Float( x:Float )="bbLog10f"
|
|
|
|
|
|
+Function Log10F:Float( x:Float )="float bbLog10f(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Smallest integral value not less than @x
|
|
bbdoc: Smallest integral value not less than @x
|
|
End Rem
|
|
End Rem
|
|
-Function CeilF:Float( x:Float )="bbCeilf"
|
|
|
|
|
|
+Function CeilF:Float( x:Float )="float bbCeilf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Largest integral value not greater than @x
|
|
bbdoc: Largest integral value not greater than @x
|
|
End Rem
|
|
End Rem
|
|
-Function FloorF:Float( x:Float )="bbFloorf"
|
|
|
|
|
|
+Function FloorF:Float( x:Float )="float bbFloorf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Nearest integral value to @x.
|
|
bbdoc: Nearest integral value to @x.
|
|
End Rem
|
|
End Rem
|
|
-Function RoundF:Float( x:Float )="bbRoundf"
|
|
|
|
|
|
+Function RoundF:Float( x:Float )="float bbRoundf(float)!"
|
|
|
|
|
|
Rem
|
|
Rem
|
|
bbdoc: Nearest integral not greater in magnitude than @x.
|
|
bbdoc: Nearest integral not greater in magnitude than @x.
|
|
End Rem
|
|
End Rem
|
|
-Function TruncF:Float( x:Float )="bbTruncf"
|
|
|
|
|
|
+Function TruncF:Float( x:Float )="float bbTruncf(float)!"
|
|
|
|
|
|
End Extern
|
|
End Extern
|