Discussion:
basic question: decimal, single, double
(too old to reply)
guy
2006-09-30 07:17:08 UTC
Permalink
when i input 3.1234567890123456789,
single data type: 3.123457
double data type: 3.12345678901235
decimal data type: 3

does it mean only single and double data type can show decimal point?

thank you!
guy
2006-09-30 10:41:04 UTC
Permalink
i mean...what's the difference between the number field size property:
single, double, decimal?
Post by guy
when i input 3.1234567890123456789,
single data type: 3.123457
double data type: 3.12345678901235
decimal data type: 3
does it mean only single and double data type can show decimal point?
thank you!
Douglas J. Steele
2006-09-30 10:58:16 UTC
Permalink
Did you try looking in the Help file?

Single (single-precision floating-point) is 4 bytes in size and can hold
negative values between -3.402823E38 and -1.401298E-45, positive values
between 1.401298E-45 and 3.402823E38 or 0

Double (double-precision floating-point) is 8 bytes in size and can hold
negative values between -1.79769313486232E308 and -4.94065645841247E-324,
positive values between 4.94065645841247E-324 and 1.79769313486232E308 or 0

Decimal is 14 bytes is size and can hold values
+/-79,228,162,514,264,337,593,543,950,335 with no decimal point; or
+/-7.9228162514264337593543950335 with 28 places to the right of the
decimal. The smallest non-zero number it can hold is
+/-0.0000000000000000000000000001

There's also Currency (scaled integer) with is 8 bytes in size, and can hold
values between -922,337,203,685,477.5808 and 922,337,203,685,477.5807
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
Post by guy
single, double, decimal?
Post by guy
when i input 3.1234567890123456789,
single data type: 3.123457
double data type: 3.12345678901235
decimal data type: 3
does it mean only single and double data type can show decimal point?
thank you!
guy
2006-09-30 11:16:18 UTC
Permalink
thank you for your reply.
i have checked the MS ACCESS help and a number of websites...i found all
these answers...

but the problem is....
when i input 3.1415926 in a number field (field size is decimal), ACCESS
automatically changed it to integer 3 and no decimal can be displayed...
why?

sorry, i am a computer idiot only...
Post by Douglas J. Steele
Did you try looking in the Help file?
Single (single-precision floating-point) is 4 bytes in size and can hold
negative values between -3.402823E38 and -1.401298E-45, positive values
between 1.401298E-45 and 3.402823E38 or 0
Double (double-precision floating-point) is 8 bytes in size and can hold
negative values between -1.79769313486232E308 and -4.94065645841247E-324,
positive values between 4.94065645841247E-324 and 1.79769313486232E308 or 0
Decimal is 14 bytes is size and can hold values
+/-79,228,162,514,264,337,593,543,950,335 with no decimal point; or
+/-7.9228162514264337593543950335 with 28 places to the right of the
decimal. The smallest non-zero number it can hold is
+/-0.0000000000000000000000000001
There's also Currency (scaled integer) with is 8 bytes in size, and can
hold values between -922,337,203,685,477.5808 and 922,337,203,685,477.5807
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
Post by guy
single, double, decimal?
Post by guy
when i input 3.1234567890123456789,
single data type: 3.123457
double data type: 3.12345678901235
decimal data type: 3
does it mean only single and double data type can show decimal point?
thank you!
Van T. Dinh
2006-09-30 13:27:37 UTC
Permalink
You need to set the Scale of the Decimal Field to 7 (for 7 decimal places)
instead of the default 0.
--
HTH
Van T. Dinh
MVP (Access)
Post by guy
thank you for your reply.
i have checked the MS ACCESS help and a number of websites...i found all
these answers...
but the problem is....
when i input 3.1415926 in a number field (field size is decimal), ACCESS
automatically changed it to integer 3 and no decimal can be displayed...
why?
sorry, i am a computer idiot only...
Post by Douglas J. Steele
Did you try looking in the Help file?
Single (single-precision floating-point) is 4 bytes in size and can hold
negative values between -3.402823E38 and -1.401298E-45, positive values
between 1.401298E-45 and 3.402823E38 or 0
Double (double-precision floating-point) is 8 bytes in size and can hold
negative values between -1.79769313486232E308 and -4.94065645841247E-324,
positive values between 4.94065645841247E-324 and 1.79769313486232E308 or 0
Decimal is 14 bytes is size and can hold values
+/-79,228,162,514,264,337,593,543,950,335 with no decimal point; or
+/-7.9228162514264337593543950335 with 28 places to the right of the
decimal. The smallest non-zero number it can hold is
+/-0.0000000000000000000000000001
There's also Currency (scaled integer) with is 8 bytes in size, and can
hold values between -922,337,203,685,477.5808 and
922,337,203,685,477.5807
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
Post by guy
single, double, decimal?
Post by guy
when i input 3.1234567890123456789,
single data type: 3.123457
double data type: 3.12345678901235
decimal data type: 3
does it mean only single and double data type can show decimal point?
thank you!
guy
2006-10-02 14:51:12 UTC
Permalink
thank you!
Post by Van T. Dinh
You need to set the Scale of the Decimal Field to 7 (for 7 decimal places)
instead of the default 0.
--
HTH
Van T. Dinh
MVP (Access)
Post by guy
thank you for your reply.
i have checked the MS ACCESS help and a number of websites...i found all
these answers...
but the problem is....
when i input 3.1415926 in a number field (field size is decimal), ACCESS
automatically changed it to integer 3 and no decimal can be displayed...
why?
sorry, i am a computer idiot only...
Post by Douglas J. Steele
Did you try looking in the Help file?
Single (single-precision floating-point) is 4 bytes in size and can hold
negative values between -3.402823E38 and -1.401298E-45, positive values
between 1.401298E-45 and 3.402823E38 or 0
Double (double-precision floating-point) is 8 bytes in size and can hold
negative values between -1.79769313486232E308
and -4.94065645841247E-324, positive values between
4.94065645841247E-324 and 1.79769313486232E308 or 0
Decimal is 14 bytes is size and can hold values
+/-79,228,162,514,264,337,593,543,950,335 with no decimal point; or
+/-7.9228162514264337593543950335 with 28 places to the right of the
decimal. The smallest non-zero number it can hold is
+/-0.0000000000000000000000000001
There's also Currency (scaled integer) with is 8 bytes in size, and can
hold values between -922,337,203,685,477.5808 and
922,337,203,685,477.5807
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
Post by guy
single, double, decimal?
Post by guy
when i input 3.1234567890123456789,
single data type: 3.123457
double data type: 3.12345678901235
decimal data type: 3
does it mean only single and double data type can show decimal point?
thank you!
onedaywhen
2006-10-03 08:53:46 UTC
Permalink
Post by Douglas J. Steele
Double (double-precision floating-point) is 8 bytes in size and can hold
negative values between -1.79769313486232E308 and -4.94065645841247E-324,
positive values between 4.94065645841247E-324 and 1.79769313486232E308 or 0
Decimal is 14 bytes is size and can hold values
+/-79,228,162,514,264,337,593,543,950,335 with no decimal point; or
+/-7.9228162514264337593543950335 with 28 places to the right of the
decimal. The smallest non-zero number it can hold is
+/-0.0000000000000000000000000001
The key to their differences is their accuracy. For their respective
ranges (stated above), the DECIMAL type can differentiate between *all*
values (i.e. is 100% accurate), whereas FLOAT (Double) uses
approximations and therefore is not always able to accurately
differentiate between close values. To test:

SELECT 0.12345678901234567 AS decimal_value_1,
decimal_value_1 + 0.00000000000000001 AS decimal_value_2,
CBOOL(decimal_value_1 = decimal_value_2) AS decimal_comparision,
CBOOL(CDBL(decimal_value_1) = CDBL(decimal_value_2)) AS
double_float_comparison;

or more simply

SELECT 0.12345678901234567 = CDBL(0.12345678901234567)

returns FALSE :(
Post by Douglas J. Steele
There's also Currency (scaled integer) with is 8 bytes in size, and can hold
values between -922,337,203,685,477.5808 and 922,337,203,685,477.5807
FWIW DECIMAL is also a scaled integer type.

Jamie.

--

Continue reading on narkive:
Loading...