注册 登录
Small Basic中文站-快乐编程 返回首页

rock的个人空间 http://www.smallbasic.cn/?5 [收藏] [复制] [分享] [RSS]

日志

SmallBasic API大全-Math属性和方法

已有 5313 次阅读2010-6-14 13:36 |个人分类:技术交流|


Math属性和方法

The Math class provides lots of useful mathematics related methods

Properties
Pi (This property is read-only.)
Math.Pi

Gets the value of Pi

Methods
Abs
Math.Abs(number)

Gets the absolute value of the given number. For example, -32.233 will return 32.233.

numberThe number to get the absolute value for. ReturnsThe absolute value of the given number.
Ceiling
Math.Ceiling(number)

Gets an integer that is greater than or equal to the specified decimal number. For example, 32.233 will return 33.

numberThe number whose ceiling is required. ReturnsThe ceiling value of the given number.
Cos
Math.Cos(angle)

Gets the cosine of the given angle in radians.

angleThe angle whose cosine is needed (in radians). ReturnsThe cosine of the given angle.
Floor
Math.Floor(number)

Gets an integer that is less than or equal to the specified decimal number. For example, 32.233 will return 32.

numberThe number whose floor value is required. ReturnsThe floor value of the given number.
GetDegrees
Math.GetDegrees(angle)

Converts a given angle in radians to degrees.

angleThe angle in radians. ReturnsThe converted angle in degrees.
GetRadians
Math.GetRadians(angle)

Converts a given angle in degrees to radians.

angleThe angle in degrees. ReturnsThe converted angle in radians.
GetRandomNumber
Math.GetRandomNumber(maxNumber)

Gets a random number between 1 and the specified maxNumber (inclusive).

maxNumberThe maximum number for the requested random value. ReturnsA Random number that is less than or equal to the specified max.
Log
Math.Log(number)

Gets the logarithm (base 10) value of the given number.

numberThe number whose logarithm value is required ReturnsThe log value of the given number
Max
Math.Max(number1, number2)

Compares two numbers and returns the greater of the two.

number1The first of the two numbers to compare. number2The second of the two numbers to compare. ReturnsThe greater value of the two numbers.
Min
Math.Min(number1, number2)

Compares two numbers and returns the smaller of the two.

number1The first of the two numbers to compare. number2The second of the two numbers to compare. ReturnsThe smaller value of the two numbers.
NaturalLog
Math.NaturalLog(number)

Gets the natural logarithm value of the given number.

numberThe number whose natural logarithm value is required. ReturnsThe natural log value of the given number.
Power
Math.Power(baseNumber, exponent)

Raises the baseNumber to the specified power.

baseNumberThe number to be raised to the exponent power. exponentThe power to raise the base number. ReturnsThe baseNumber raised to the specified exponent.
Remainder
Math.Remainder(dividend, divisor)

Divides the first number by the second and returns the remainder.

dividendThe number to divide. divisorThe number that divides. ReturnsThe remainder after the division.
Round
Math.Round(number)

Rounds a given number to the nearest integer. For example 32.233 will be rounded to 32.0 while 32.566 will be rounded to 33.

numberThe number whose approximation is required. ReturnsThe rounded value of the given number.
Sin
Math.Sin(angle)

Gets the sine of the given angle in radians.

angleThe angle whose sine is needed (in radians) ReturnsThe sine of the given angle
SquareRoot
Math.SquareRoot(number)

Gets the square root of a given number.

numberThe number whose square root value is needed. ReturnsThe square root value of the given number.
Tan
Math.Tan(angle)

Gets the tangent of the given angle in radians.

angleThe angle whose tangent is needed (in radians). ReturnsThe tangent of the given angle.

路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

手机版|小黑屋|Small Basic中文站-快乐编程 ( 闽ICP备09051788号 |

GMT+8, 2017-6-23 18:17 , Processed in 0.149425 second(s), 20 queries .

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

返回顶部