decimal data type

P

Patrih

I've some problems understanding how decimal data type
works (in Access2000 at least): Is it a number or is it
stored as a string with specifics codes for its sign and
point place?
My problem is relative to its range: in fact, the guide
tells that this type of data accepts number from -10E28-1
to 10E28-1, but if you try to put -10E28-1 you receive an
error message. The natural thing (data types in C++ for
example) is to give the typical range from -10E28 to 10E28-
1 (as for int type, also in access: from 0 to 255). But if
you try with -10E28 you have an error too. The greater
negative number you can insert is -10E28+1, but in this
case you loose a digit.
 
A

Albert D. Kallal

From the help file I get (assuming your newsreader is set to fixed font, the
below should read as nice table:

Decimal 14 bytes +/-79,228,162,514,264,337,593,543,950,335 with
no decimal point;
+/-7.9228162514264337593543950335 with
28 places to the right of the decimal;
smallest non-zero number is
+/-0.0000000000000000000000000001

I always used currency type for accouting stuff. Don't know if the above
helps...

The rest of the data types follow.



Data type Storage size Range
Byte 1 byte 0 to 255
Boolean 2 bytes True or False
Integer 2 bytes -32,768 to 32,767

Long
(long integer) 4 bytes -2,147,483,648 to 2,147,483,647

Single
(single-precision floating-point)
4 bytes -3.402823E38 to -1.401298E-45 for
negative values;
1.401298E-45 to 3.402823E38 for
positive values
Double
(double-precision floating-point)
8 bytes -1.79769313486232E308 to
-4.94065645841247E-324 for
negative values;
4.94065645841247E-324 to
1.79769313486232E308 for
positive values


Currency
(scaled integer) 8 bytes -922,337,203,685,477.5808 to
922,337,203,685,477.5807

Decimal 14 bytes +/-79,228,162,514,264,337,593,543,950,335 with
no decimal point;
+/-7.9228162514264337593543950335 with
28 places to the right of the decimal;
smallest non-zero number is
+/-0.0000000000000000000000000001

Date 8 bytes January 1, 100 to December 31, 9999

Object 4 bytes Any Object reference

String
(variable-length) 10 bytes + string length 0 to
approximately 2 billion
Variant
(with numbers) 16 bytes Any numeric value up to the
range of a Double Variant
Variant
(with characters) 22 bytes + string length Same range as for
variable-length String
 
A

Allen Browne

The decimal data type is a fixed point number, and you can specify the
number of decimal places. The largest number you can assign to the field is
dependent on how many decimal places you want.

Unless you really need this data type, it may not be worth the bother. It is
only partially implimented in Access. For example, there is no Decimal data
type in VBA, so you can only handle it as a variant of subtype Decimal.
That's restrictive (e.g. you can't declare a constant of this type) and less
efficient.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top