Unwanted rounding of numbers

C

Casa

Hello everyone

I have a question about displaying numbers in Access. I have a table with
two number columns. Their field size is "single", and their format is
"general number". The decimal places allowed is four. From what I gather, I
can type in a number to two decimal places. But this is not the case. For
example:

460260.43 becomes 460260.4
AND
5557166.29 becomes 5557167

All I want to do is be able to display my numbers correctly. Why is this
rounding off happening, and what can I do to change it?

Thanks!

Casa
 
J

John Vinson

Hello everyone

I have a question about displaying numbers in Access. I have a table with
two number columns. Their field size is "single", and their format is
"general number". The decimal places allowed is four. From what I gather, I
can type in a number to two decimal places. But this is not the case. For
example:

460260.43 becomes 460260.4
AND
5557166.29 becomes 5557167

All I want to do is be able to display my numbers correctly. Why is this
rounding off happening, and what can I do to change it?

Use Double... or see below.

A Single number is NOT stored as decimals; it's stored as a binary
fraction (with 24 bits) multiplied by an exponent. As such, it's
limited to approximately seven decimal places precision - you can
store a number up to 10^58 or so, but only seven digits of it will be
kept. A Double stores up to some 14 digits.

An even better choice might be to not use any of the Number datatypes
- use Currency instead. It's a huge scaled integer, with a range into
the trillions, and exactly four (no more no fewer) decimal places.

John W. Vinson[MVP]
(no longer chatting for now)
 

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