By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,225 Members | 1,434 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,225 IT Pros & Developers. It's quick & easy.

Trouble standardizing decimal nos.

P: 2
I've been trying to standardize "single"-type numbers that are processed in a module. I need exactly 4 decimal places all the time, but the system always seems to ignore place-holding 0s. (i.e. 5, not 5.0000; 0.295, not 0.2950)

The temporary table these are stored in is Single with default 4 decimal places
I have played with combinations of Format, FormatNumber, and Round yet it never seems consistently 4 decimals

Any advice? - Gina Grafilo
Jul 8 '09 #1
Share this Question
Share on Google+
6 Replies


Expert 100+
P: 1,287
Where are you trying to display the result? FormatNumber will return a String, so if your control is an unformatted text box, you shouldn't have a problem.
Jul 8 '09 #2

ADezii
Expert 5K+
P: 8,679
@grafilo
In Table Design View, for a Single Data Type Field, try setting the Number of Decimal Places to 4, and the Format of the Field to Standard.
Jul 8 '09 #3

100+
P: 675
In Table Design View, for a Single Data Type Field, try setting the Number of Decimal Places to 4, and the Format of the Field to Standard.
This should have Format as Fixed, not Standard.

But this is cosmetic. A numeric field, whether in a table or on a form, contains a value. A Single would have 2 components, an Exponent a Significand. In the case of a value of 5, the exponent is 0 and the significand is 5. Adding a decimal point and any number of 0s does not make this representation more or less accurate. 5 = 5.0000000000000000

If the problem is displaying the numbers, this is a Format issue. If the problem is accuracy in calculations, then the issue is more complex. All the Number or Currency data types store data as binary numbers, and therefore cannot represent the fractional part of the value accurately. The number of bits devoted to the fractional part is enough so that this is not normally a problem, but it could be.

The numbers are stored in a temporary table. Just storing them cannot matter how they are formatted. How are they used? What is the reason for needing 'place-holding' trailing zeros?
Jul 8 '09 #4

ADezii
Expert 5K+
P: 8,679
@OldBirdman
Fixed will not display the Thousands separator while Standard will, which under certain conditions may be beneficial.
Jul 8 '09 #5

100+
P: 675
Fixed will not display the Thousands separator while Standard will, which under certain conditions may be beneficial.
You are correct. I ran a test but must have made a mistake.
Jul 9 '09 #6

P: 2
Format = Fixed didn't work. Format = Standard did.

Thanks everyone! - Gina Grafilo
Jul 17 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.