Possible Duplicate:
decimal vs double! - Which one should I use and when?
I'm using double
type for price in my trading software.
I've noticed that sometimes there are a odd errors.
They occur if price contains 4 digits after "dot", like 2.1234.
When I sent from my program "2.1234" on the market order appears at the price of "2.1235".
I don't use decimal
because I don't need "extreme" precision. I don't need to distinguish for examle "2.00000000003" from "2.00000000002". I need maximum 6 digits after a dot.
The question is - where is the line? When to use decimal
?
Should I use decimal
for any finansical operations? Even if I need just one digit after the dot? (1.1 1.2 etc.)
I know decimal
is pretty slow so I would prefer to use double
unless decimal
is absolutely required.