Decimal precision and calculations

K

Krisse

I need to have what I see be what I get in mathmatical
calculations. I am struggling with odd fractions of a
penny.

I am dealing with dollars, but in the end I need to create
a number with 2 digits to the right of an implied decimal
in order to load data into a system conversion table.

Is there a best way to define these numeric fields?
(Fieldsize double, format, decimal places). I see that
numbers are not always stored as they look, even with a
currency data type. I've been using double, but am still
having trouble sometimes.

Can you help? Thanks!
 
A

Allen Browne

Use the Round() function to force the data to 2 decimal places before
storing.

The Double is probably the most appropriate type, but the Currency type will
be more precise as it can store the fractional part exactly.
 
K

Krisse

Thanks, Allen.


-----Original Message-----
Use the Round() function to force the data to 2 decimal places before
storing.

The Double is probably the most appropriate type, but the Currency type will
be more precise as it can store the fractional part exactly.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.




.
 

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