I am trying to accurately represent floating point numbers in Swift. Let's say that we have a number let doubleNumber = 16.756
. The problem with this is that the actual number is something like 16.7560009
. More over, on different phone it is 16.7559991
for example, because of processor inequalities. Fixed point arithmetic should be the answer to this kind of problems, but I have no idea how to tackle it in Swift. To be honest, nor in other languages. So how do I create fixed point representations of floating point numbers in Swift?
The reason I am asking is that when simulating physics accurately across devices the tiny differences in the value of floating point number can cause completely different physics simulations.