Popular mathematical functions are summarized in the following table. Note that certain functions do not require the Math. prefix.
Mathematical Function in .NET
Math.Abs() Returns the absolute value.
Math.Abs(-10) returns 10.
Math.Ceiling() Returns an integer that is greater than or equal to a number.
Math.Ceiling(5.333) returns 6.
Fix() Returns the integer portion of a number.
Fix(5.3333) returns 5.
Math.Floor() Returns an integer that is less than or equal to a number.
Fix(5.3333) returns 5.
Int() Returns the integer portion of a number.
Int(5.3333) returns 5.
Math.Max() Returns the larger of two numbers.
Math.Max(5,7) returns 7.
Math.Min() Returns the smaller of two numbers.
Math.Min(5,7) returns 5.
Math.Pow() Returns a number raised to a power.
Math.Pow(12,2) returns 144.
Rnd() Returns a random number between 0 and 1. Used in conjunction with Randomizestatement to initialize the random number generator.
Math.Round() Rounds a number to a specified number of decimal places. Rounds up on .5.
Math.Round(1.1234567,5) returns 1.12346.
Math.Sign() Returns the sign of a number. Returns -1 if negative and 1 if positive.
Math.Sign(-5) returns -1.
Math.Sqrt() Returns the square root of a positive number.
Math.Sqrt(144) returns 12.
Google Search
Monday, May 28, 2007
Mathematical Functions in .NET
Tags : Tips -Tricks
Subscribe to:
Post Comments (Atom)
2 comments:
good Tips and Tricks
Foto Jengger Ayam Pada Wanita | Obat Jengger Ayam Di Apotik | Gambar Kutil Kelamin 2010 | Biaya Operasi Laser Kutil Kelamin | Gambar Penyakit Jengger Ayam Pada Wanita
Post a Comment