-
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?
-
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.
-
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.
-
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.