View Poll Results: Will using an integer for cash like above work?
- Voters
- 2. You may not vote on this poll
-
Oct 2nd, 2002, 04:01 PM
#1
Thread Starter
Member
Integer with Decimals
Ok, so here's my thought I am developing a program that has small cash values (should never be more than a few thousand. I am thinking of using an integer value /1000 as the data type (I need to round off correctly and am interested in the tenth of a cent. Any thoughts?
-
Oct 2nd, 2002, 05:21 PM
#2
Fanatic Member
I would still use the decimal data type. This data type is designed for handeling floating point numbers where as integer divided by 1000 is not. You may get rounding problems using the integer method.
-
Oct 2nd, 2002, 06:08 PM
#3
Thread Starter
Member
hmmmm
I'm not really concerned with anything beyond a tenth of a cent for rounding purposes. Any other reasons why I shouldn't use integer/1000.
-
Oct 3rd, 2002, 04:28 AM
#4
New Member
I would suggest you do not attempt "to save the byte" by using an integer to represent a floating point number. Think about code maintenance and all unforeseen problems in the future. What are the gains? Few megs saved? Few disk i/o's? Hardware prices are way lower than the price of laborious coding.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|