VB.Net by API/System/Double

Материал из VB Эксперт
Перейти к: навигация, поиск

Double.Epsilon

  
public class Test
   public Shared Sub Main
        Dim D As Double
    
        D = 5
        Console.WriteLine(D.Epsilon)
   End Sub
End class


Double.IsNaN()

  
    
Imports System                
Module MyModule
  Sub Main()
    If (Double.IsNaN("1.2")) Then
      Console.WriteLine("Not a Number.")
    End If
  End Sub
End Module


Double.IsNegativeInfinity()

  
 
Imports System                
Module MyModule
  Sub Main()
    If (Double.IsNegativeInfinity("0.0000000000000001")) Then
        Console.WriteLine("Negative infinity.")
    End If
  End Sub
End Module


Double.IsPositiveInfinity()

  
Imports System                
Module MyModule
  Sub Main()
    If (Double.IsPositiveInfinity("999999999999999999999999999999999")) Then
      Console.WriteLine("Positive infinity.")
    End If
  End Sub
End Module


Double.MaxValue

  
Public Class Tester
    Public Shared Sub Main
    
        Dim result As New System.Text.StringBuilder
        Dim maxSingle As Single = Single.MaxValue
        Dim maxDouble As Double = Double.MaxValue
        Dim sizeOfSingle As Integer = Runtime.InteropServices.Marshal.SizeOf(maxSingle.GetType)
        Dim sizeOfDouble As Integer = Runtime.InteropServices.Marshal.SizeOf(maxDouble.GetType)
        result.Append("Memory size of a Single (bytes): ")
        result.AppendLine(sizeOfSingle)
        result.Append("Maximum value of a Single: ")
        result.AppendLine(maxSingle)
        result.AppendLine()
        result.Append("Memory size of a Double (bytes): ")
        result.AppendLine(sizeOfDouble)
        result.Append("Maximum value of a Double: ")
        result.AppendLine(maxDouble)
        Console.WriteLine(result.ToString())
     End Sub
End Class


Double.Parse

  

Public Class Tester
    Public Shared Sub Main
        Dim doubleParse As Double = Double.Parse("3.1416")
        Console.WriteLine(doubleParse)
    End Sub

End Class


Double.ToString(String format)

  
 
Public Class Tester
    Public Shared Sub Main
        Dim dblNum As Double = 2123.456
        Console.WriteLine(dblNum.ToString("#,###.###000"))
    End Sub
End Class