Number type - decimal vs. Lng

Thread: Number type - decimal vs. Lng

1. Senior Member
Join Date
Dec 1969
Posts
2,892

Number type - decimal vs. Lng

Can someone explain to me why and when I would select Decimal as my field type in Access? Isn&#039;t 72.324 a valid Long Integer, given that you can choose how many decimal places you want Access to store it to? And if so, what does the Decimal type give you that Long doesn&#039;t? Just greater precision?<BR><BR>Thanks

2. Senior Member
Join Date
Dec 1969
Posts
96,118

Integers don't *HAVE* decimal places

So no, 72.324 isn&#039;t *ANY* kind of valid integer. By definition.<BR><BR>Look here:<BR>http://dictionary.reference.com/search?q=integer<BR>

3. Senior Member
Join Date
Dec 1969
Posts
2,892

RE: Number type - decimal vs. Lng

Ok, so Access provides a Single number Type and I missed it. It&#039;s late, what can I say?

4. Senior Member
Join Date
Dec 1969
Posts
2,892

RE: Integers don't *HAVE* decimal places

Yeah, yeah, yeah, that was stoopid, I know! Fell flat on my face, even worse than when my 7 year old beats me at tic-tac-toe.<BR><BR>Reminds me of that riddle: A 727 carrying 128 people is travelling North by North-East from Western US into Canada. The plane experiences technical problems and goes down. It slams into the ground on the US side, but slides into Canada so that it stops exactly half-in US and half-in Canada. So, where do you bury the survivors?<BR><BR>Good night

5. Senior Member
Join Date
Dec 1969
Posts
96,118

Never use SINGLE

SINGLE is a floating point number that has only 6 digits of precision.<BR><BR>So 6727.774 (for example) can NOT be represented accurately using a SINGLE value. [It will get represented as, ROUGHLY, 6.72777E+03, except in binary floating point, not decimal floating point.]<BR><BR>If you are going to use floating point, always use DOUBLE. <BR><BR>But if you really *do* want fixed point numbers, then indeed do use DECIMAL.<BR><BR>Of course, then you have the problem that VBScript can&#039;t work with DECIMAL numbers. So in VBS you&#039;ll end up having to convert them to double, anyway.<BR><BR>But so long as you are working *in* the DB, decimal datatypes are likely what you want.<BR>

6. Senior Member
Join Date
Dec 1969
Posts
96,118

They'd be buried in...

...red tape.<BR><BR>Now how can *anybody* lose a tic-tac-toe??? It&#039;s impossible to lose if played correctly. First "computer" I even built did nothing but play tic-tac-toe. In days before integrated circuites. Done with Christmas tree lights and diodes and lots of DPDT switches. And it would only win if you pushed it into doing so, but at least it never lost.<BR><BR>

7. Senior Member
Join Date
Dec 1969
Posts
5,955

Bill, based on what you just posted...

...you must be at least sixty years old. ;-)<BR><BR>Oliver.

8. Senior Member
Join Date
Dec 1969
Posts
5,955

If you have a fixed number of...

...decimal points, you might even consider using integers (Long or less, depending on how large the numbers get) and then divide by 10^x, where x is the number of decimal points you want, e.g.:<BR><BR>- 3 decimal points: 10^3 = 1000<BR>- Number 1.234 stored as 1234 in the database<BR>- 1234 / 1000 = 1.234<BR><BR>That way you won&#039;t have problems with precision and rounding.<BR><BR>Oliver.

9. Senior Member
Join Date
Dec 1969
Posts
96,118

Not true!

Still two months to go.<BR><BR>

10. Senior Member
Join Date
Dec 1969
Posts
96,118

Ummmm...Oliver....

how do you think DECIMAL numbers *are* stored in the database?<BR><BR>You just described the SQL Server scheme, at least.<BR><BR>

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•