VB.Net by API/System/Math — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 16:40, 26 мая 2010
Содержание
Math.Acos
Imports System
Imports System.Data
Imports System.Diagnostics
public class MainClass
Shared Sub Main()
Console.WriteLine(System.Math.Acos(0))
Console.WriteLine(System.Math.Cos(10))
End Sub
End Class
Math.Asin
Imports System
Imports System.Data
Imports System.Diagnostics
public class MainClass
Shared Sub Main()
Console.WriteLine(System.Math.Asin(0))
Console.WriteLine(System.Math.Sin(10))
End Sub
End Class
Math.Atan
Imports System
public class MainClass
Shared Sub Main()
Console.WriteLine(System.Math.Atan(10))
Console.WriteLine(System.Math.Tan(10))
End Sub
End Class
Math.Atan2
Public Class Tester
Public Shared Sub Main
Dim magnitude As Single
Dim radians As Single
magnitude = CSng(Math.Sqrt(100 ^ 2 + 120 ^ 2))
radians = CSng(Math.Atan2(100, 123))
Console.WriteLine(magnitude)
Console.WriteLine(radians)
End Sub
End Class
Math.Cos
Public Class Tester
Public Shared Sub Main
Dim X As Single
Dim Y As Single
X = CSng( Math.Cos(100))
Y = CSng( Math.Sin(100))
Console.WriteLine(X)
Console.WriteLine(Y)
End Sub
End Class
Math.Floor
Module Module1
Sub Main()
Console.WriteLine("Ceiling(1.1), Ceiling(0.9) = " & Math.Ceiling(1.1) & " " & Math.Ceiling(0.9))
Console.WriteLine("Exp(5) = " & Math.Exp(5))
Console.WriteLine("Log10(100) = " & Math.Log10(100))
Console.WriteLine("Max(1001, 100) = " & Math.Max(1001, 100))
Console.WriteLine("Min(1001, 100) = " & Math.Min(1001, 100))
Console.WriteLine("Floor(1.1), Floor(0.9) = " & Math.Floor(1.1) & " " & Math.Floor(0.9))
Console.WriteLine("Round(1.1), Round(0.9) = " & Math.Round(1.1) & " " & Math.Round(0.9))
End Sub
End Module
Math.Max
Imports System
Public Class MainClass
Shared Sub Main(ByVal args As String())
Console.WriteLine(Math.Max(Math.Max(1, 2), 3))
End Sub
End Class
Math.PI
Imports System
Public Class MainClass
Shared Sub Main()
Dim dblRadiusSquared As Double
Dim dblResult As Double
Dim radius As Double
radius = 10.01
dblRadiusSquared = radius * radius
dblResult = dblRadiusSquared * Math.PI
System.Console.WriteLine(dblResult)
End Sub
End Class
Math.Pow
Imports System.IO
Module Module1
Sub Main()
Console.WriteLine("Absolute value of -1 is " & Math.Abs(-1))
Console.WriteLine("Square Root of 144 is " & Math.Sqrt(144))
Console.WriteLine("Value for PI is " & Math.PI)
Console.WriteLine("10 raised to the power of 2 is " & Math.Pow(10, 2))
End Sub
End Module
Math.Round
Imports System
Imports System.Data
Imports System.Diagnostics
public class MainClass
Shared Sub Main()
Console.WriteLine(System.Math.Round(1.4))
End Sub
End Class
Math.Sign
Imports System
public class MainClass
Shared Sub Main()
Console.WriteLine(System.Math.Sign(-1))
Console.WriteLine(System.Math.Sign(0))
Console.WriteLine(System.Math.Sign(1))
End Sub
End Class
Math.Sin
Public Class Tester
Public Shared Sub Main
Dim X As Single
Dim Y As Single
X = CSng( Math.Cos(100))
Y = CSng( Math.Sin(100))
Console.WriteLine(X)
Console.WriteLine(Y)
End Sub
End Class
Math.Sqrt
Public Class Tester
Public Shared Sub Main
Dim magnitude As Single
Dim radians As Single
magnitude = CSng(Math.Sqrt(100 ^ 2 + 120 ^ 2))
radians = CSng(Math.Atan2(100, 123))
Console.WriteLine(magnitude)
Console.WriteLine(radians)
End Sub
End Class