# GBIC: Math

The following is reprinted for archival purposes from Gary Beene's Information Center, with permission from Mr. Beene himself.

`'VB normally operates in decimal notation, but hexadecimal (base 16)`

'and octal (base 8) can also be use

'decimal

MyVar = 25.2

'hexidecimal

MyVar = &H14A

'octal

MyVar = &O37

'VB support the following mathematical functions

'Base conversions

Hex 'returns Hex string representation of a number

Oct 'returns Octal string representation of a number

Val 'returns content of string converted to a number

'Controlling number of decimals in a number

Round

Int 'returns integer portion of a number. if negative, returns first negative integet <+ to the number

Fix 'returns integer portion of a number. if negative, returns first nteger greater than or equal to number

'Mathematical formula

Sin 'sine

Cos 'cosine

Tan 'tangent

Sqr 'square root

Abs 'absolute value

Atn 'arctangent

Log 'logarithm to the base 10

'related random variables

Rnd 'random number between 0 and 1

Randomize 'seeds the Rnd function so that it doesn't return the same value each time a program runs

Sgn 'sign of a number 1 for > 0, 0 for 0, -1 for < 0

Partition 'returns a string indicating where a number occurs within a calculated series of ranges

'These functions are available to convert one data type to another

Loading Comments ...

## Comments

No comments have been added for this post.

*You must be logged in to make a comment.*