**MBS Xojo Developer Conference and Training**

Join us from 3rd to 6th May 2017 in Berlin, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

**ACosHMBS(x as Double) as Double**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**This function computes the inverse hyperbolic cosine of the real argument x.

**Example:**

```
MsgBox str(ACosHMBS(5))
```

**Notes:**

acosh(1) returns +0.

acosh(x) returns a NAN for x < 1.

acosh(+infinity) returns +infinity.

**ACosMBS(x as Double) as Double**

global method, Math, MBS Util Plugin (Math),

Plugin version: 5.3, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**This function computes the principal value of the arc cosine of x in the range [0, pi].

**Example:**

```
MsgBox str(ACosMBS(5))
```

**Notes:**

acos(1) returns +0.

acos(x) returns a NAN for |x| > 1.

**ArithmeticShiftMBS(value as UInt64, count as Integer) as UInt64**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Does an arithmetic Shift of value and cares for the sign (+ or -).

**Example:**

`msgbox str(ArithmeticShiftMBS(5,3))`

// displays 40 which is 5*(2^3) = 5 * 8

**Notes:**Always using 32bit.

Some examples using this method:

**ASinHMBS(x as Double) as Double**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**This function computes the principal value of the arc sine of x in the range [-pi/2, +pi/2].

**Example:**

```
MsgBox str(ASinHMBS(5))
```

**Notes:**

asin(+-0) returns +-0.

asin(x) returns a NAN for |x| > 1.

**ASinMBS(x as Double) as Double**

global method, Math, MBS Util Plugin (Math),

Plugin version: 5.3, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**This function computes the principal value of the arc sine of x in the range [-pi/2, +pi/2].

**Example:**

```
MsgBox str(ASinMBS(5))
```

**Notes:**

asin(+-0) returns +-0.

asin(x) returns a NAN for |x| > 1.

**ATan2MBS(x as Double, y as Double) as Double**

global method, Math, MBS Util Plugin (Math),

Plugin version: 5.3, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**This function computes the principal value of the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value.

**Example:**

```
MsgBox str(ATan2MBS(3,4))
```

**Notes:**

atan2(+-0, -0) returns +-pi.

atan2(+-0, +0) returns +-0.

atan2(+-0, x) returns +-pi for x < 0.

atan2(+-0, x) returns +-0 for x > 0.

atan2(y, +-0) returns -pi/2 for y > 0.

atan2(+-y, -infinity) returns +-pi for finite y > 0.

atan2(+-y, +infinity) returns +-0 for finite y > 0.

atan2(+-infinity, +x) returns +-pi/2 for finite x.

atan2(+-infinity, -infinity) returns +-3*pi/4.

atan2(+-infinity, +infinity) returns +-pi/4.

**ATanHMBS(x as Double) as Double**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**This function computes the inverse hyperbolic tangent of the real argument x.

**Example:**

```
MsgBox str(ATanHMBS(5))
```

**Notes:**

atanh(+-0) returns +-0.

atanh(+-1) returns +-infinity.

atanh(x) returns a NaN for |x| > 1.

**ATanMBS(x as Double) as Double**

global method, Math, MBS Util Plugin (Math),

Plugin version: 5.3, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**The atan() function computes the principal value of the arc tangent of x in the range [-pi/2, +pi/2].

**Example:**

```
MsgBox str(ATanMBS(5))
```

**Notes:**

atan(+-0) returns +-0.

atan(+-infinity) returns +-pi/2.

**BitClearMBS(value as UInt64, mask as UInt64) as UInt64**

global method, Math, MBS Util Plugin (Math),

Plugin version: 6.0, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Clears the bits in the mask from the value.

**Example:**

```
MsgBox bin(BitClearMBS(&b1111,&b0110)) // 1001
```

**Notes:**Does not work for 64 bit integers.

**BitCountMBS(value as UInt64) as Integer**

global method, Math, MBS Util Plugin (Math),

Plugin version: 6.0, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Counts the number of bits set.

**Example:**

`MsgBox str(BitCountMBS(&b101)) // 2`

MsgBox str(BitCountMBS(&b10101)) // 5

MsgBox str(BitCountMBS(&b11111111111100001111)) // 16

MsgBox str(BitCountMBS(&hFFFFFFFF)) // 32

**Notes:**Does not work for 64 bit integers.

**BitExclMBS(value as UInt64, bitNumber as Integer) as UInt64**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**

Does an bitwiseAnd using the value and bitwisenot of 2^bitNumber.

Or: Switches off the bit bitNumber inside value.

**Example:**

`msgBox str(BitExclMBS(80,4))`

' displays 64 which is 80 without 16 = 2^4+2^5 without 2^4

**Notes:**Always using 64-bit.

Some examples using this method:

**BitInclMBS(value as UInt64, bitNumber as Integer) as UInt64**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**

Does an bitwiseOr using the value and 2^bitNumber

Or: Switches on the bit bitNumber inside value.

**Example:**

`msgBox str(BitInclMBS(64,4))`

' displays 80 which is 64 + 16 = 64 + 2^4

**Notes:**Always using 64-bit.

Some examples using this method:

**BitIsSetMBS(value as UInt64, bitNumber as Integer) as Boolean**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Tests whether a certain bit is set inside the value

**Example:**

`dim bool as boolean`

bool=BitIsSetMBS(80,4)

' true, because 2^4=16 is included in 80=2^4+2^6

**Notes:**Always using 64-bit.

Some examples using this method:

**BitValMBS(bitNumber as Integer) as UInt64**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Returns 2^bitNumber

**Example:**

`msgBox str(BitValMBS(5))`

' displays 32

**Notes:**Always using 64-bit.

Some examples using this method:

**BitwiseDiffMBS(x as UInt64, y as UInt64) as UInt64**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Returns all bits of val1 which are not in val2.

**Example:**

`msgBox str(BitwiseDiffMBS(65,80))`

' displays 1, because 65=2^0+2^5 includes 1=2^0, which is not part of 80=2^4+2^5.

**Notes:**Always using 32bit.

**BitwiseNAndMBS(x as UInt64, y as UInt64) as UInt64**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**negates both values and does bitwiseAnd on them.

**Example:**

`msgBox str(bitwiseNandMBS(65,80))`

' displays -82

**Notes:**Always using 32bit.

**BitwiseNOrMBS(x as UInt64, y as UInt64) as UInt64**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**negates both values and does bitwiseor on them.

**Example:**

`msgBox str(bitwisenorMBS(65,80))`

' displays -65

**Notes:**Always using 32bit.

**BitwiseNotMBS(value as UInt64) as UInt64**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Does an bitwise negation of value.

**Example:**

`msgBox str(BitwiseNotMBS(5))`

' displays -6

**Notes:**Always using 32bit.

Some examples using this method:

**BitwiseRotateMBS(value as UInt64, count as Integer, offset as Integer, width as Integer) as UInt64**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Does an bitwise rotation of value.

**Example:**

`msgBox str(BitwiseRotateMBS(5,2,0,32))`

' displays 20

**Notes:**Always using 32bit.

Some examples using this method:

**ConvertFromFloat16MBS(Number as UInt16) as Single**

global method, Math, MBS Util Plugin (Math),

Plugin version: 15.0, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Converts a 16bit floating point number to a 32bit floating point number.

**Example:**

`dim h1 as UInt16 = ConvertToFloat16MBS(1.0)`

dim f1 as single = ConvertFromFloat16MBS(h1) // should be 1.0

dim h2 as UInt16 = ConvertToFloat16MBS(-1.0)

dim f2 as single = ConvertFromFloat16MBS(h2) // should be -1.0

dim h3 as UInt16 = ConvertToFloat16MBS(1000.0)

dim f3 as single = ConvertFromFloat16MBS(h3) // should be 1000.0

dim h4 as UInt16 = ConvertToFloat16MBS(-1000.0)

dim f4 as single = ConvertFromFloat16MBS(h4) // should be -1000.0

dim inf as single = 65504.0

dim h5 as UInt16 = ConvertToFloat16MBS(inf)

dim f5 as single = ConvertFromFloat16MBS(h5) // should be 65504

dim nan as single = sqrt(-1)

dim h6 as UInt16 = ConvertToFloat16MBS(nan)

dim f6 as single = ConvertFromFloat16MBS(h6) // should be NAN

Break // check in debugger

**ConvertToFloat16MBS(Number as Single) as UInt16**

global method, Math, MBS Util Plugin (Math),

Plugin version: 15.0, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Converts a 32bit floating point number to a 16bit floating point number.

**Example:**

`dim h1 as UInt16 = ConvertToFloat16MBS(1.0)`

dim f1 as single = ConvertFromFloat16MBS(h1) // should be 1.0

dim h2 as UInt16 = ConvertToFloat16MBS(-1.0)

dim f2 as single = ConvertFromFloat16MBS(h2) // should be -1.0

dim h3 as UInt16 = ConvertToFloat16MBS(1000.0)

dim f3 as single = ConvertFromFloat16MBS(h3) // should be 1000.0

dim h4 as UInt16 = ConvertToFloat16MBS(-1000.0)

dim f4 as single = ConvertFromFloat16MBS(h4) // should be -1000.0

dim inf as single = 65504.0

dim h5 as UInt16 = ConvertToFloat16MBS(inf)

dim f5 as single = ConvertFromFloat16MBS(h5) // should be 65504

dim nan as single = sqrt(-1)

dim h6 as UInt16 = ConvertToFloat16MBS(nan)

dim f6 as single = ConvertFromFloat16MBS(h6) // should be NAN

Break // check in debugger

**Notes:**This looses precision as 16bit fit less bits than 32 bit.

**CosHMBS(x as Double) as Double**

global method, Math, MBS Util Plugin (Math),

Plugin version: 5.3, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**This function computes the hyperbolic cosine of x.

**Example:**

```
MsgBox str(CosHMBS(5))
```

**Notes:**

cosh(+-0) returns 1.

cosh(+-infinity) returns +infinity.

Some examples using this method:

**CosMBS(x as Double) as Double**

global method, Math, MBS Util Plugin (Math),

Plugin version: 5.3, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**This function computes the cosine of x (measured in radians).

**Example:**

```
MsgBox str(CosMBS(5))
```

**Notes:**

cos(+-0) returns 1.

cos(+-infinity) returns a NaN.

**CurrencyAddMBS(value1 as Currency, value2 as Currency) as Currency**

global method, Math, MBS Util Plugin (Math),

Plugin version: 14.3, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Adds two currency values.

**Notes:**This function uses 64bit integer math to avoid rounding issues.

**CurrencyDivMBS(value1 as Currency, value2 as Integer) as Currency**

global method, Math, MBS Util Plugin (Math),

Plugin version: 14.3, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Divides currency value by integer.

**Notes:**

Rest is ignored.

This function uses 64bit integer math to avoid rounding issues.

**CurrencyMulMBS(value1 as Currency, value2 as Integer) as Currency**

global method, Math, MBS Util Plugin (Math),

Plugin version: 14.3, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Multiplies currency value with integer.

**Example:**

`dim c1 as Currency = 1234567890.1234`

// in xojo

dim c3 as Currency = c1 * 12345

// with plugin

dim c4 as Currency = CurrencyMulMBS(c1, 12345)

// verify by 64bit math

dim c5 as Int64 = 12345678901234

dim c6 as int64 = c5 * 12345

// and plugin is correct

MsgBox str(c3)+" "+str(c4)+" "+str(c6)

**Notes:**This function uses 64bit integer math to avoid rounding issues.

**CurrencySubMBS(value1 as Currency, value2 as Currency) as Currency**

global method, Math, MBS Util Plugin (Math),

Plugin version: 14.3, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Subtracts value2 from value1.

**Notes:**This function uses 64bit integer math to avoid rounding issues.

**CurrencyValueMBS(value as string) as Currency**

global method, Math, MBS Util Plugin (Math),

Plugin version: 14.3, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

**Function:**Parses string into currency value.

**Notes:**Replacement for val() which works better with large numbers and raises exceptions on errors.

Some examples using this method:

**DoubleToExtendedStrMBS(x as Double) as string**

global method, Math, MBS Util Plugin (Math),

Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

**Function:**Returns the double as an 80bit Float stored inside a ten byte string.

**Example:**

`dim s as string`

dim d as Double

d=5

s=DoubleToExtendedStrMBS(d)

msgBox s

d=extendedStrToDoubleMBS(s)

msgBox str(d)

**Notes:**Returns "" if there is not enough memory to create the string.

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

Links

MBS Xojo Plugins