money and smallmoney  decimal and numeric

Chapter 7: Adding, Changing, and Deleting Data

float, real, and double precision

You enter the approximate numeric types—float, real, and double precision—as a mantissa followed by an optional exponent. The mantissa can include a positive or negative sign and a decimal point. The exponent, which begins after the character “e” or “E”, can include a sign but not a decimal point.

To evaluate approximate numeric data, Adaptive Server multiplies the mantissa by 10 raised to the given exponent. Table 7-1 shows examples of float, real, and double precision data:

Table 7-1: Evaluating numeric data

Data entered

Mantissa

Exponent

Value

10E2

10

2

10 * 102

15.3e1

15.3

1

15.3 * 101

-2.e5

-2

5

-2 * 105

2.2e-1

2.2

-1

2.2 * 10-1

+56E+2

56

2

56 * 102

The column’s binary precision determines the maximum number of binary digits allowed in the mantissa. For float columns, you can specify a precision of up to 48 digits; for real and double precision columns, the precision is machine-dependent. If a value exceeds the column’s binary precision, Adaptive Server flags the entry as an error.





Copyright © 2005. Sybase Inc. All rights reserved. decimal and numeric

View this book as PDF