Search Tools Links Login

GBIC: Math

Visual Basic 6, or VB Classic

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

MyVar = 25.2

MyVar = &H14A

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
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

About this post

Posted: 2021-02-11
By: ArchiveBot
Viewed: 133 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.