Class MathFunctions
- java.lang.Object
-
- com.scriptbasic.utility.functions.MathFunctions
-
public class MathFunctions extends java.lang.ObjectThis class contains static methods that are place holders to register the methods of the classjava.lang.Mathfor the BASIC programs. If the documentation of the method does not specify different then the method in this class can be invoked directly from a BASIC program and does exactly the same as the method of the same name in the classjava.lang.Math.When a method accepts
Numberarguments it means that the BASIC can call the function with integer or with floating point arguments.- Author:
- Peter Verhas
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Numberabs(java.lang.Number x)static doubleacos(double x)static doubleasin(double x)static doubleatan(double x)static doubleatan2(double x, double y)static doublecbrt(double x)static doubleceil(double x)static doublecopySign(double magnitude, double sign)static doublecos(double x)static doublecosh(double x)static doubleexp(double a)static doubleexpm1(double x)static java.lang.DoublefloatF(java.lang.Object s)Convert a value to floating point.static doublefloor(double x)static java.lang.LonggetExponent(double d)static doublehypot(double x, double y)static doubleIEEEremainder(double f1, double f2)static java.lang.Longinteger(java.lang.Object s)Convert a value to integer.static doublelog(double x)static doublelog10(double x)static doublelog1p(double x)static java.lang.Numbermax(java.lang.Number a, java.lang.Number b)static java.lang.Numbermin(java.lang.Number a, java.lang.Number b)static doublepow(double a, double b)static doublerandom()static doublerint(double a)static doubleround(double x)static doublescalb(double d, int scaleFactor)static doublesignum(double d)static doublesin(double x)static doublesinh(double x)static doublesqrt(double a)static doubletan(double x)static doubletanh(double x)static doubletoDegrees(double angrad)static doubletoRadians(double angdeg)
-
-
-
Method Detail
-
abs
public static java.lang.Number abs(java.lang.Number x) throws ScriptBasicException- Throws:
ScriptBasicException
-
acos
public static double acos(double x)
-
asin
public static double asin(double x)
-
atan
public static double atan(double x)
-
atan2
public static double atan2(double x, double y)
-
cbrt
public static double cbrt(double x)
-
ceil
public static double ceil(double x)
-
copySign
public static double copySign(double magnitude, double sign)
-
cos
public static double cos(double x)
-
cosh
public static double cosh(double x)
-
exp
public static double exp(double a)
-
expm1
public static double expm1(double x)
-
floatF
public static java.lang.Double floatF(java.lang.Object s)
Convert a value to floating point. This method can be called directly from the BASIC program and it will return a java Double, that is internally a BASIC float. (Note that ScriptBasic for Java does not use float or int, only Long and Double.)Use this function from the BASIC program if the BASIC interpreter does not convert automatically a number to floating point but you need a floating point number and not an integer.
- Parameters:
s- the number to convert- Returns:
- the converted number or
null, which means undefined in BASIC in case the parameterspassed can not be converted to floating point
-
integer
public static java.lang.Long integer(java.lang.Object s)
Convert a value to integer. This method can be called directly from the BASIC program and it will return a java Long, that is internally a BASIC integer. (Note that ScriptBasic for Java does not use float or int, only Long and Double.)Use this function from the BASIC program if the BASIC interpreter does not convert automatically a number to integer but you need an integer number and not a floating point number.
- Parameters:
s- the number to convert- Returns:
- the converted number or
null, which means undefined in BASIC in case the parameterspassed can not be converted to integer
-
floor
public static double floor(double x)
-
getExponent
public static java.lang.Long getExponent(double d)
-
hypot
public static double hypot(double x, double y)
-
IEEEremainder
public static double IEEEremainder(double f1, double f2)
-
log
public static double log(double x)
-
log10
public static double log10(double x)
-
log1p
public static double log1p(double x)
-
max
public static java.lang.Number max(java.lang.Number a, java.lang.Number b)
-
min
public static java.lang.Number min(java.lang.Number a, java.lang.Number b)
-
pow
public static double pow(double a, double b)
-
random
public static double random()
-
rint
public static double rint(double a)
-
round
public static double round(double x)
-
scalb
public static double scalb(double d, int scaleFactor)
-
signum
public static double signum(double d)
-
sin
public static double sin(double x)
-
sinh
public static double sinh(double x)
-
sqrt
public static double sqrt(double a)
-
tan
public static double tan(double x)
-
tanh
public static double tanh(double x)
-
toDegrees
public static double toDegrees(double angrad)
-
toRadians
public static double toRadians(double angdeg)
-
-