The following sections present detailed information on the standard arithmetic and trigonometric operations that are built into GPL. As a convenience during editing, all of these operations are provided as methods to the MathClass. This allows programmers to display a pick list of the Math methods and easily see all of operations that are available.
As is standard in GPL, conversions between different arithmetic types, e.g. Boolean, Integer, Single, Double, are automatically performed as required. So, it is not necessary to have different variations on these methods to deal with the different possible mixes of input parameter data types. Also, these methods generally produce results that are formatted as Double’s. These results will automatically be converted to smaller data types as necessary, e.g. Double -> Integer, and will not generate an error so long as numeric overflow does not occur.
Table 19-65 briefly summarizes the methods that are described in greater detail in the following sections.
Method | Description |
---|---|
Math.Abs (expression) |
Returns the absolute value of any arithmetic expression. |
Math.Acos( cosine ) |
Returns the angle that corresponds to a specified cosine value. |
Math.Asin( sine ) |
Returns the angle that corresponds to a specified sine value. |
Math.Atan( tangent ) |
Returns the angle that corresponds to a specified tangent value. |
Math.Atan2( sine_factor, cosine_factor ) |
Returns the angle that corresponds to the quotient of two values. |
Math.Ceiling (value) |
Returns the smallest integer number that is greater than or equal to a value. |
Math.Cos( angle ) |
Returns the cosine of a specified angle. |
Math.Cosh( angle ) |
Returns the hyperbolic cosine of a specified angle. |
Returns the natural logarithmic base constant. |
|
Math.Exp( exponent ) |
Returns the natural logarithmic constant, e, raised to a specified power. |
Math.Floor (value) |
Returns the largest integer number that is less than or equal to a value. |
Math.Log (value) |
Returns the natural logarithm (base-e logarithm) of a specified value. |
Math.Log10 (value) |
Returns the base-10 logarithm of a specified value. |
Math.Max (value_1, value_2) |
Returns the larger of two values. |
Math.Min (value_1, value_2) |
Returns the smaller of two values. |
Returns the constant π. |
|
Math.Pow (base, exponent) |
Returns a specified base value raised to a specified power. |
Math.Sign (value) |
Returns a number that indicates the sign of a specified value. |
Math.Sin (angle) |
Returns the sine of a specified angle. |
Math.Sinh (angle) |
Returns the hyperbolic sine of a specified angle. |
Math.Sqrt (value) |
Returns the square root of a value. |
Math.Tan (angle) |
Returns the tangent of a specified angle. |
Math.Tanh (angle) |
Returns the hyperbolic tangent of a specified angle. |