4 ms·
I agree that you should not use floating numbers for amounts of money (maybe with some kind of calculations it might be suitable, but this is rare), but I do no
by zzo38computer 7y ago
I agree that you should not use floating numbers for amounts of money (maybe with some kind of calculations it might be suitable, but this is rare), but I do not deal with calculations involving money on the computer so much. But, yes normally integers are better for the amount of money (and for some other stuff that normally involves fractions, too; if fixed point is suitable (as is the case for money), then integers are probably better than using floating point). (Comment 22322487, and its replies, also mentions why sometimes floating point is used, but normally to record amounts of money, integers are better. As other comments mention, sometimes you might even use other types such as rational type.)