Small Basic: Parameter or Return Value Range for Math Function
This article describes the ranges of parameters or return values for Small Basic Math functions. This article is work in progress. So "N/A" means that the range is not investigated yet. Please edit this article if you know any range information about Math functions in Small Basic.
In this article floating point expression is used such as 7.9E28 that means 7.9 x 1028.
Basically, Microsoft Small Basic is one of .NET framework language. So, internally Decimal number might be used. Most of limit may come from Decimal number.
Literal Numbers
This limitation is only for literal numbers but not for literal texts. Following code shows this fact.
n = 1000000000000001
TextWindow.WriteLine(n) ' 1000000000000000
n = "1000000000000001"
TextWindow.WriteLine(n) ' 1000000000000001
Range
-1E15 = -1000000000000000 ≦ literal ≦ 1000000000000000 = 1E15
Sample Program
Arithmetic Operators
Small Basic has 4 arithmetic operators - "+" (add), "-" (subtract), "*" (multiple) and "/" (divide).
+
number1 + number2
Range
number1 + number2 ≦ 79228162514264337593543950335 = 7.9E28
Sample Program
-
number1 - number2
Range
N/A
*
number1 * number2
Range
N/A
/
number1 / number2
Range
number1 ≧ 0.0000000000000000000000000001 (= 1E-28) while number2 = 10
Sample Program
Math Functions
In Small Basic, Math object has 20 operations (functions).
Abs
Range
-7.92281625142643E28 = -79228162514264300000000000000 ≦ number ≦ 79228162514264300000000000000 = 7.92281625142643E28
0 ≦ Math.Abs(number) ≦ 79228162514264300000000000000 = 7.92281625142643E28
Sample Program
ArcCos
Range
-1 ≦ cosValue ≦ 1
0 ≦ Math.ArcCos(cosValue) ≦ Math.Pi
ArcSin
Range
-1 ≦ sinValue ≦ 1
-Math.Pi / 2 ≦ Math.ArcSin(sinValue) ≦ Math.Pi / 2
ArcTan
Range
-Math.Pi / 2 < Math.ArcTan(tanValue) < Math.Pi / 2
N/A ≦ tanValue ≦ N/A
Ceiling
Range
N/A
Cos
Range
-1 ≦ Math.Cos(angle) ≦ 1
Floor
Range
N/A
GetDegrees
Math.GetDegrees(angle)
Range
-360 < Math.GetDegrees(angle) < 360
GetRadians
Math.GetRadians(angle)
Range
-2 * Math.Pi < Math.GetRadians(angle) < 2 * Math.Pi
GetRandomNumber
Math.GetRandomNumber(maxNumber)
Range
N/A
Log
Range
0 < number ≦ N/A
Max
Math.Max(number1, number2)
Range
Number of significant digits is limited to the return value of Math.Max function.
Sample Program
Min
Math.Min(number1, number2)
Range
N/A
NaturalLog
Range
0 < number ≦ N/A
Power
Math.Power(baseNumber, exponent)
Range
baseNumber ≦ 31622776 while exponent = 2
exponent ≦ 49 while baseNumber = 2
Sample Program
FFW588 for Math.Power(31622776, 2)
Remainder
Math.Remainder(dividend, divisor)
Range
Math.Remainder(9007199254740992, 2)
dividend ≦ 9007199254740992 = 9E15 while divisor = 2
-divisor < Math.Remainder(dividend, divisor) < divisor
Round
Range
N/A
Sin
Range
-1 ≦ Math.Sin(angle) ≦ 1
SquareRoot
Range
0 ≦ number ≦ 19807040628566084398385987584 = 1.9E28
Tan
Range
N/A
Sample Program
Other Resources
- Number ranges on Math functions - Small Basic (Small Basic Forum)
- Smallest & largest Numbers that sb can handle (Small Basic Forum)
- Calculate with Big Numbers in Small Basic (Small Basic Forum)
- Decimal Data Type (Visual Basic) (MSDN Library)
- Small Basic - Limits of Literals (Small Basic Blog)