kmote
Seg Fault'n,
- Messages
- 5,801
I'm not sure what kmote is referring to, perhaps he feels you should use a Long Double.
He's talking about C++ and many other languages using the CPU to do decimal calculations. The CPU never returns an exact value when dividing, multiplying etc. There really isn't a true way around it in C++. However, in other languages built from C++ such as Python and PHP, they have data types that support exact calculations. In Python check out the "decimal.decimal" type.
Yeah, basically this.
What do you suggest I use?
Honestly, you can stick with doubles for the time being, it's probably not worth too much of your time at such an early stage of development, you just need to be aware that sometimes your calculations will come out rounded in strange ways (I'm told there's an IEEE spec describing it). I'm not a C++ guy but if you really want to look for something, you could search for something like "C++ precision math library".