Numeric Types


Numeric XSD types can be divided into primitive numeric types and derived numeric types. Figure A-2 shows the relationship among numeric types in the XSD type hierarchy, with the primitive numeric types appearing in ovals.

click to expand
Figure A-2: The numeric type group; primitive types are in ovals.

Primitive Numeric Types

As you saw in Figure A-2, the primitive numeric types are double, decimal, and float. We’ll look at each of these in some detail.

decimal

The decimal type represents the infinite set of all decimal numbers. It lexically covers all decimal numbers of finite length, optionally preceded by or trailed by any number of zeros. You can use + or – to indicate whether the number is positive or negative.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

integer

DECIMAL

System.Decimal

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

 
<dec>42</dec> <dec>+4567.8723</dec> <dec>-000023.2</dec> 

double

The double type represents the set of Institute of Electrical and Electronics Engineers (IEEE) double-precision 64-bit floating-point numbers—the values from +253 2970 to 1 2–1075 and from –1 2–1075 to –253 2970. The double type also contains the values NaN, INF, 0, –0, –INF. The exponent section of the number should be represented with an uppercase E.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

None

FLOAT

System.Double

Applicable Facets

enumeration, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, whiteSpace

Examples

<double>42</double> <double>4.5678723E3</double> <double>-000034.431000E-10</double> 

float

The float type represents the set of IEEE single-precision 32-bit floating-point numbers—the values from +224 2104 to 1 2–149 and from –1 2–149 to –224 2104. Float also contains the values NaN, INF, 0, –0, –INF. The exponent section of the number should be represented with an uppercase E.

Base Type

Derived Type

SQL Server Type

.NET Type

anySimpleType

None

REAL

System.Single

Applicable Facets

enumeration, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, whiteSpace

Examples

<float>42</float> <float>4.5678723E3</float> <float>-000034.431000E-10</float> 

Derived Numeric Types

Following are the rest of the numeric types.

integer

The integer type represents the infinite set of all decimal numbers that contain no digits after the decimal point. It lexically covers all integers of finite length, optionally preceded by any number of zeros. You can use + or – to indicate whether the number is positive or negative.

Base Type

Derived Type

SQL Server Type

.NET Type

decimal

long, nonPositiveInteger, nonNegativeInteger

BIGINT

System.Decimal

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<integer>42</integer> <integer>+4567</integer> <integer>-000023</integer> 

long

The long type represents the set of all integers that can be stored as a signed integer in a 64-bit field—all integers between –9223372036854775808 and 9223372036854775807. You can use + or – to indicate whether the number is positive or negative.

Base Type

Derived Type

SQL Server Type

.NET Type

integer

int

BIGINT

System.Int64

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<long>0</long> <long>+123456789000</long> <long>-000023</long> 

int

The int type represents the set of all integers that can be stored as a signed integer in a 32- bit field—all integers between 2147483647 and –2147483648. You can use + or – to indicate whether the number is positive or negative.

Base Type

Derived Type

SQL Server Type

.NET Type

long

short

INT

System.Int32

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<int>0</int> <int>+123456789</int> <int>-54</int> 

short

The short type represents the set of all integers that can be stored as a signed integer in a 16-bit field—all integers between 32767 and –32768. You can use + or – to indicate whether the number is positive or negative.

Base Type

Derived Type

SQL Server Type

.NET Type

int

byte

SMALLINT

System.Int16

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<short>0</short> <short>+12345</short> <short>-54</short> 

byte

The byte type represents the set of all integers that can be stored as a signed integer in a 8- bit field—all integers between 127 and –128. You can use + or – to indicate whether the number is positive or negative.

Base Type

Derived Type

SQL Server Type

.NET Type

short

N/A

SMALLINT

System.SByte

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<byte>0</byte> <byte>+123</byte> <byte>-54</byte> 

nonPositiveInteger

The nonPositiveInteger type represents the infinite set of all integers between zero and negative infinity inclusive. It lexically covers all negative integers of finite length and zero, optionally preceded by any number of zeros.

Base Type

Derived Type

SQL Server Type

.NET Type

integer

negativeInteger

BIGINT

System.Decimal

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<npint>0</npint> <npint>-4567</npint> <npint>-000023</npint> 

negativeInteger

The negativeInteger type represents the infinite set of all integers between -1 and negative infinity inclusive. It lexically covers all negative integers of finite length, optionally preceded by any number of zeros.

Base Type

Derived Type

SQL Server Type

.NET Type

nonPositiveInteger

N/A

BIGINT

System.Decimal

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<nint>-4567</nint> <nint>-000023</nint> 

nonNegativeInteger

The nonNegativeInteger type represents the infinite set of all integers between zero and positive infinity inclusive. It lexically covers all positive integers of finite length and zero, optionally preceded by any number of zeros.

Base Type

Derived Type

SQL Server Type

.NET Type

integer

positiveInteger, unsignedLong

BIGINT

System.Decimal

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<nnint>0</nnint> <nnint>+4567</nnint> <nnint>000023</nnint> 

positiveInteger

The positiveInteger type represents the infinite set of all integers between 1 and positive infinity inclusive. It lexically covers all positive integers of finite length, optionally preceded by any number of zeros. You can include a + sign.

Base Type

Derived Type

SQL Server Type

.NET Type

nonNegativeInteger

N/A

BIGINT

System.Decimal

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<pint>+4567</pint> <pint>000023</pint> 

unsignedLong

The unsignedLong type represents the set of all nonnegative integers that can be stored in a 64-bit field—all integers between 0 and +18446744073709551615.

Base Type

Derived Type

SQL Server Type

.NET Type

nonNegativeInteger

unsignedInt

N/A

System.UInt64

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<ulong>0</ulong> <ulong>+09876554321000</ulong> <ulong>000023</ulong> 

unsignedInt

The unsignedInt type represents the set of all nonnegative integers that can be stored in a 32-bit field—all integers between 0 and +4294967295.

Base Type

Derived Type

SQL Server Type

.NET Type

unsignedLong

unsignedShort

BIGINT

System.UInt32

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<uint>0</uint> <uint>+098765543</uint> <uint>000023</uint> 

unsignedShort

The unsignedShort type represents the set of all nonnegative integers that can be stored in a 16-bit field—all integers between 0 and +65535.

Base Type

Derived Type

SQL Server Type

.NET Type

unsignedInt

unsignedByte

INT

System.UInt16

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<ushort>0</ushort> <ushort>+9876</ushort> <ushort>000023</ushort> 

unsignedByte

The unsignedByte type represents the set of all nonnegative integers that can be stored in an 8-bit field—all integers between 0 and +255.

Base Type

Derived Type

SQL Server Type

.NET Type

unsignedShort

N/A

TINYINT

System.Byte

Applicable Facets

enumeration, fractionDigits, maxExclusive, minExclusive, maxInclusive, minInclusive, pattern, totalDigits, whiteSpace

Examples

<ubyte>0</ubyte> <ubyte>+98</ubyte> <ubyte>000023</ubyte> 




Programming Microsoft. NET XML Web Services
Programming MicrosoftВ® .NET XML Web Services (Pro-Developer)
ISBN: 0735619123
EAN: 2147483647
Year: 2005
Pages: 172

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net