473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Decimals rounding up to whole numbers

reginaldmerritt
201 100+
I have a table with fields which need to hold 3 decimal placed numbers. e.g. '0.934'.

However, the numbers get rounded up to '1' and never displayed as '0.934'.

I have the field's properties set to 3 Decimal places and I have tried all different types of field size settings.

What do I need to to to make the filed hold and display decimal numbers?

Thanks.
Sep 8 '10 #1

✓ answered by NeoPa

Single and Double can work for you in a limited way, but especially with Single, you can run into problems when dealing with rounding of calculations. The more appropriate settings would be :
Data Type = Number
Field Size = Decimal
Scale = 3

To show this data it may also be helpful to set :
Format = Standard
Decimal Places = 3

If you're determined to use a floating point type (Field size = Single or Double) then I would certainly recommend Double as it has more precision so is less likely to suffer from rounding errors.

5 5161
You need to change the field size to either single or double. I think you have it set as integer or long.
Sep 9 '10 #2
reginaldmerritt
201 100+
Thanks Darren. I thought Integer or Decimal would allow for decimal places. Your quite right in saying single or double is the correct field size to use.

Setting field size to single fixed my problem, many thanks.

Wasn't sure if it was the field size setting or something else but in any case i guess i should have looked here first. http://office.microsoft.com/en-us/ac...010274716.aspx

Many Thanks.
Sep 9 '10 #3
NeoPa
32,556 Expert Mod 16PB
Single and Double can work for you in a limited way, but especially with Single, you can run into problems when dealing with rounding of calculations. The more appropriate settings would be :
Data Type = Number
Field Size = Decimal
Scale = 3

To show this data it may also be helpful to set :
Format = Standard
Decimal Places = 3

If you're determined to use a floating point type (Field size = Single or Double) then I would certainly recommend Double as it has more precision so is less likely to suffer from rounding errors.
Sep 9 '10 #4
reginaldmerritt
201 100+
I'm now using Decimal Field Size, I didn't realise I had to set the Scale property when using a Decimal Field Size, this is why it didn't work for me before.

Many thanks, Neo Pa.
Sep 10 '10 #5
NeoPa
32,556 Expert Mod 16PB
Glad to help Reginald :)
Sep 10 '10 #6

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

Similar topics

2
by: Jack Higgs | last post by:
I'm building a maths program for year 6 children. Problem with division - I generate a random number between say 1 and 1000. I want to generate another random number which when divided by the...
22
by: Allen Thompson | last post by:
Is there a script that will round off a number to a certain number of decimal places? -Allen Thompson
4
by: Mark | last post by:
Hi all, I have a query which returns 56 results every time. 1 field of the query contains the results of an expression where 55 will contain decimal points and 1 will be a whole number. Is there a...
3
by: Neils Christoffersen | last post by:
Hey all, I wrote on Friday asking for some help moving a common subclass field up to the base class (original post and followup included below). This entails storing whole numbers inside float...
4
by: Will | last post by:
Hey guys Quick question: how do i find out if the remainder of 4 divided by 2 is a whole number ? NEED CODE PLEAS THANX IN ADVANCE
17
by: Dooglo | last post by:
I've forgotten. How do I round off numbers from an equation or round off to the third decimal point for instance. eg. answers number is 12345.678910
1
by: sconnors | last post by:
I am currently working on an application that runs on Windows XP SP2 with .NET 2.0, Linux 2.4.19-16mdkenterprise and Solaris 5.9. The language is C++. When I compare the output numbers, Windows...
14
by: kaykae | last post by:
Hi all, Please help me with this. I'm trying to round up numbers in a column i designed within a query.....the only function I can find that Ms.Access has is the round()......which only rounds...
5
by: Randeh | last post by:
Simple bubbling sort algorithm, nothing fancy, just trying to find a way to validate each number value as it's entered without creating several arrays and loops using isdigit(). I need to validate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.