dbTalk Databases Forums  

how to get rid of Random numbers being generated during calculations

comp.databases.ms-access comp.databases.ms-access


Discuss how to get rid of Random numbers being generated during calculations in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
MPan
 
Posts: n/a

Default how to get rid of Random numbers being generated during calculations - 07-28-2003 , 12:57 PM






Hi,

I am trying to perform calculations using some queries about 5 of them
in a row...but somehow after calculations...if the answer is supposed
to be 100 it gives me 100.00034265....

PLease let me know if there is a way of getting rid of these random
numbers being added on...

for the number's i am using 'single' as my field datatype with decimal
places set to 2 decimal places...

PLease advise.

Thanks

Reply With Quote
  #2  
Old   
Lyle Fairfield
 
Posts: n/a

Default Re: how to get rid of Random numbers being generated during calculations - 07-28-2003 , 01:16 PM






May.Pan (AT) dfa (DOT) state.ny.us (MPan) wrote in news:8c2a8ec9.0307280957.7dc0ff3
@posting.google.com:

Quote:
Hi,

I am trying to perform calculations using some queries about 5 of them
in a row...but somehow after calculations...if the answer is supposed
to be 100 it gives me 100.00034265....

PLease let me know if there is a way of getting rid of these random
numbers being added on...

for the number's i am using 'single' as my field datatype with decimal
places set to 2 decimal places...

PLease advise.

Thanks
Lots of way ... perhaps setting the field type to Currency is a good one.

--
Lyle



Reply With Quote
  #3  
Old   
May Pan
 
Posts: n/a

Default Re: how to get rid of Random numbers being generated during calculations - 07-28-2003 , 01:57 PM




Thank you Lyle,

I've tried that and it is still not rectifying the problem. Any other
suggestions?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #4  
Old   
Lyle Fairfield
 
Posts: n/a

Default Re: how to get rid of Random numbers being generated during calculations - 07-28-2003 , 06:21 PM



May Pan <may.pan (AT) dfa (DOT) state.ny.us> wrote in news:3f257218$0$194$75868355
@news.frii.net:

Quote:
Thank you Lyle,

I've tried that and it is still not rectifying the problem. Any other
suggestions?
A currency field shows and calculates a maximum of 4 places of decimals. So
if you are seeing more than 4 places of decimals, I am guessing you are
seeing something else. Rather than having us guess what this is, probably
it's more effcient if you post your query strings and/or code.
--
Lyle



Reply With Quote
  #5  
Old   
XMVP
 
Posts: n/a

Default Re: how to get rid of Random numbers being generated during calculations - 07-28-2003 , 06:29 PM




"May Pan" <may.pan (AT) dfa (DOT) state.ny.us> wrote

Quote:
Thank you Lyle,

I've tried that and it is still not rectifying the problem. Any other
suggestions?


In time, it may pan out.




Reply With Quote
  #6  
Old   
Trevor Best
 
Posts: n/a

Default Re: how to get rid of Random numbers being generated during calculations - 07-29-2003 , 02:01 AM



On Tue, 29 Jul 2003 00:53:38 GMT in comp.databases.ms-access, Chuck
Grimsby <c.grimsby (AT) worldnet (DOT) att.net.invalid> wrote:

Quote:
The best solution I've come up with to get around this issue is the
one the old Main Frame programmers came up with: "Do all your math as
integers."

In other words, if you need 2 decimal place precision, multiply your
numbers by 100 to get a integer, do the math (don't forget to also
multiply by 100 the other numbers in the equation!), then convert back
when / as needed.
The Currency data type does this for you.

--
Ride Free (but you still have to pay for the petrol)

(replace sithlord with trevor for email)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.