Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

Previous items

Exp2MBS(x as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: This function computes 2^x, the base-2 exponential of x.
Example:
MsgBox str(Exp2MBS(5))
Notes:
exp2(+-0) return 1.
exp2(-infinity) return +0.
exp2(+infinity) return +infinity.

Feedback, Comments & Corrections

ExpMBS(x as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: This function computes e^x, the base-e exponential of x.
Example:
MsgBox str(ExpMBS(5))
Notes:
exp(+-0) return 1.
exp(-infinity) return +0.
exp(+infinity) return +infinity.

Blog Entries

Feedback, Comments & Corrections

ExtendedStrToDoubleMBS(v as string) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin Yes No No Yes, macOS only No
Function: Returns the 80bit Float as a double.
Example:
dim s as string
dim d as Double

d=5
s=DoubleToExtendedStrMBS(d)
msgBox s
d=extendedStrToDoubleMBS(s)
msgBox str(d)
Notes:
Returns NAN (255) if the string is not valid. e.g. "".
Returns always NAN on Windows.

Feedback, Comments & Corrections

FacMBS(x as Integer) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin Yes Yes Yes Yes No
Function: Calculates (value!).
Example:
Sub Open()
// Fill a listbox with Fac values:
dim x as Integer
dim y as Double

for x=1 to 100
listBox1.addrow format(x,"0")
y=FacMBS(x)
if y=0 then
exit
else
listBox1.cell(listBox1.lastIndex,1)=format(y,"0")
end if
next
End Sub
Notes:
msgBox str(facMBS(5))
' displays 120 which is 1*2*3*4*5

Feedback, Comments & Corrections

FloorMBS(x as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: This function returns the largest integral value less than or equal to x.
Example:
MsgBox str(FloorMBS(5.45))
Notes:
floor(+-0) returns +-0.
floor(+-infinity) returns +-infinity.

Blog Entries

Feedback, Comments & Corrections

FRExpMBS(inputx as Double, byref expValue as Integer) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: Breaks floating-point number into normalized fraction and power of 2.
Example:
dim x as Double = 123.456

dim y as Integer
dim r as Double = FRExpMBS(x, y)

MsgBox str(X)+": "+str(y)+" "+str(r)
Notes:
This functions break the floating-point number value into a normalized fraction and an integral power of 2. They store the integer in the int object pointed to by exp.

The functions return a number x such that x has a magnitude in the interval [1/2, 1) or 0, and value = x*(2^exp).

frexp(+-0, exp) returns +-0, and stores 0 in the object pointed to by exp.

frexp(+-infinity, exp) returns +-infinity, and stores an unspecified value in the object pointed to by exp.

frexp(Nan, exp) returns a Nan, and stores an unspecified value in the object pointed to by exp.

Feedback, Comments & Corrections

HiWordMBS(i as Integer) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 3.1 Yes Yes Yes Yes No
Function: Returns the high word part of the integer.
Example:
MsgBox hex(HiWordMBS(&H12345678)) // shows 1234
Notes: equal to bitwiseshiftright(i,16)

Some examples using this method:

Feedback, Comments & Corrections

HypotMBS(x as Double, y as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: This function computes the sqrt(x*x+y*y) without undue overflow or underflow.
Example:
MsgBox str(HypotMBS(3,4)) // shows 5
Notes:
hypot(x, y) , hypot(y, x) , and hypot(x, -y) are equivalent.
hypot(x, +-0) is equivalent to fabs(x).
hypot(+-infinity, y) returns +infinity even if y is a NaN.

Feedback, Comments & Corrections

IsFiniteMBS(x as Double) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin Yes Yes Yes Yes No
Function: Returns true if the parameter is finite.
Example:
dim x as Double

x=1/0
if not isfiniteMBS(x) then
msgbox "the result is Infinite."
end if

Feedback, Comments & Corrections

IsInfMBS(x as Double) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 4.2 Yes Yes Yes Yes No
Function: Returns true if the double passed in is an infinity value.
Example:
dim e as Double = 0.0000000000000000000000000000000000000000000000001
dim d as Double = 1.0/e/e/e/e/e/e/e

MsgBox str(d)+" is inf: "+str(IsInfMBS(d))

Feedback, Comments & Corrections

IsNANMBS(x as Double) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin Yes Yes Yes Yes No
Function: Returns true if the parameter is not a number.
Example:
dim x as Double
x=sqrt(-1)
if isnanMBS(x) then
msgbox "the square root of -1 is not correct."
end if

Feedback, Comments & Corrections

Log10MBS(x as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: This function computes the value of the logarithm of argument x to base 10.
Example:
MsgBox str(Log10MBS(5))
Notes:
log10(1) return +0.
log10(x) return a NaN for x < 0.
log10(+infinity) return +infinity.

Blog Entries

Feedback, Comments & Corrections

Log2MBS(x as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: This function computes the value of the logarithm of argument x to base 2.
Example:
MsgBox str(Log2MBS(5))
Notes:
log2(1) return +0.
log2(x) return a NaN for x < 0.
log2(+infinity) return +infinity.

Feedback, Comments & Corrections

LogicalShiftMBS(value as UInt64, count as Integer) as UInt64
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin Yes Yes Yes Yes No
Function: Does an logical Shift of value and doesn't take care for the sign (+ or -).
Example:
msgbox str(LogicalShiftMBS(5,3))
Notes: Always using 32bit.

Some examples using this method:

Feedback, Comments & Corrections

LogMBS(x as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: This function computes the value of the logarithm of argument x to base e.
Example:
MsgBox str(LogMBS(5))
Notes:
log(1) return +0.
log(x) return a NaN for x < 0.
log(+infinity) return +infinity.

Blog Entries

Feedback, Comments & Corrections

LoWordMBS(i as Integer) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 3.1 Yes Yes Yes Yes No
Function: Returns the low word part of the integer.
Example:
MsgBox hex(LoWordMBS(&H12345678)) // shows 5678
Notes: equal to bitwiseand(i,&HFFFF)

Some examples using this method:

Feedback, Comments & Corrections

PowMBS(x as Double, y as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: This function computes x raised to the power y.
Example:
MsgBox str(PowMBS(5,5))
Notes:
pow(+-0, y) returns +-infinity for y an odd integer < 0.
pow(+-0, y) returns +infinity for y < 0 and not an odd integer.
pow(+-0, y) returns +-0 for y an odd integer > 0.
pow(+-0, y) returns +0 for y > 0 and not an odd integer.
pow(-1, +-infinity) returns 1.
pow(1, y) returns 1 for any y, even a NaN.
pow(x, +-0) returns 1 for any x, even a NaN.
pow(x, y) returns a NaN for finite x < 0 and finite non-integer y.
pow(x, -infinity) returns +infinity for |x| < 1.
pow(x, -infinity) returns +0 for |x| > 1.
pow(x, +infinity) returns +0 for |x| < 1.
pow(x, +infinity) returns +infinity for |x| > 1.
pow(-infinity, y) returns -0 for y an odd integer < 0.
pow(-infinity, y) returns +0 for y < 0 and not an odd integer.
pow(-infinity, y) returns -infinity for y an odd integer > 0.
pow(-infinity, y) returns +infinity for y > 0 and not an odd integer.
pow(+infinity, y) returns +0 for y < 0.
pow(+infinity, y) returns +infinity for y > 0.

Range errors may occur.

Blog Entries

Feedback, Comments & Corrections

RoundMBS(x as Double, decimals as Integer = 0) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: This function returns the integral value nearest to x rounding half-way cases away from zero, regardless of the current rounding direction.
Example:
MsgBox str(RoundMBS(5.5))

dim lines(-1) as string

for i as Integer = -5 to 5
lines.Append str(i)+": "+Format(RoundMBS(123456789.123456789, i), "0.0000000")
next

MsgBox join(lines,EndOfLine)
Notes:
round(+-0) returns +-0.
round(+-infinity) returns +-infinity.

Blog Entries

Feedback, Comments & Corrections

SinHMBS(x as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin Yes Yes Yes Yes No
Function: This function computes the hyperbolic sine of x.
Example:
MsgBox str(SinHMBS(5.5))
Notes:
sinh(+-0) returns +-0.
sinh(+-infinity) returns +-infinity.

Blog Entries

Feedback, Comments & Corrections

SinMBS(x as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: This function computes the sine of x (measured in radians).
Example:
MsgBox str(SinMBS(5.5))
Notes:
sin(+-0) returns +-0.
sin(+-infinity) returns a NaN.

Blog Entries

Feedback, Comments & Corrections

SqrtMBS(x as Double, y as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: This function compute the yth root of x.
Example:
dim r,x,y as Double

r=SqrtMBS(x,y)
// r^y=x
Notes:
sqrt(-0) returns -0.
sqrt(x,y) returns a NaN if the root can't be calculated.

Blog Entries

Feedback, Comments & Corrections

TanHMBS(x as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin Yes Yes Yes Yes No
Function: This function computes the hyperbolic tangent of x.
Example:
MsgBox str(TanHMBS(5.5))
Notes:
tanh(+-0) returns +-0.
tanh(+-infinity) returns +-1.

Blog Entries

Feedback, Comments & Corrections

TanMBS(x as Double) as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Math MBS Util Plugin 5.3 Yes Yes Yes Yes No
Function: This function computes the tangent of x (measured in radians).
Example:
MsgBox str(TanMBS(5.5))
Notes:
tan(+-0) returns +-0.
tan(+-infinity) returns a NaN.

Blog Entries

Feedback, Comments & Corrections

Previous items

The items on this page are in the following plugins: MBS Util Plugin.




Links
MBS Xojo tutorial videos