O'Reilly logo

VB.NET Core Classes in a Nutshell by Ted Neward, Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Decimal

Synopsis

This simple value type is commonly used for financial calculations, which can preserve a significant number of fractional digits with no round-off error. Decimals are stored as 12-byte signed integers scaled by a variable power of 10. This means that a decimal data type can effectively hold 28 significant digits without losing any information. With a scale of 0 (no decimal places), the largest possible value is approximately 7.92x1028. This type is available in VB.NET through the Decimal alias.

Public Structure Decimal : Implements IFormattable, IComparable, IConvertible
' Public Constructors
   Public Sub New( ByVal value As Double) 
   Public Sub New( ByVal value As Integer) 
   Public Sub New( ByVal bits As Integer()) 
   Public Sub New(ByVal lo As Integer, ByVal mid As Integer, 
        ByVal hi As Integer, ByVal isNegative As Boolean, 
        ByVal scale As Byte) 
   Public Sub New( ByVal value As Long) 
   Public Sub New( ByVal value As Single) 
   Public Sub New( ByVal value As UInt32) 
   Public Sub New( ByVal value As UInt64) 
' Public Shared Fields
   Public Shared ReadOnly MaxValue As Decimal                    // =79228162514264337593543950335
   Public Shared ReadOnly MinusOne As Decimal                    // =-1
   Public Shared ReadOnly MinValue As Decimal                    // =-79228162514264337593543950335
   Public Shared ReadOnly One As Decimal                         // =1
   Public Shared ReadOnly Zero As Decimal                        // =0
                  ' Public Shared Methods
   Public Shared Function Add(ByVal d1 As Decimal, 
        ByVal d2 As Decimal) As Decimal  
   Public Shared Function Compare(ByVal d1 As Decimal, ByVal ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required