Does it need to be (i.e. external constraint), or you don't want to change it?
It's possible to convert between the double and integer formats, though as the compiler's warning you against, you...
Type: Posts; User: helloworld922
Does it need to be (i.e. external constraint), or you don't want to change it?
It's possible to convert between the double and integer formats, though as the compiler's warning you against, you...
It's due to how floating points are represented. The math is rather involved, but if you're interested, see IEEE 754-2008 - Wikipedia, the free encyclopedia.
One solution is to replace everywhere...
This is a problem with using floating points and truncation errors. The simplest solution is to represent the money amount using integers for cents. You can then get the dollar amounts back using...