I have a strange problem in C # on visual studio 2013 (.NET framework 4.0):
When I compile running the following code from the main thread:
As a result, I get: "Result: 89999998976"
When I run the same code from another thread in the same executable, I get:
"Result: 90000000000"
It seems that the double in the main stream is considered as a float (32 bit precision instead of 64 bit precision).
Does anyone know why this is happening?
EDIT:
I have found the answer. I am using Managed DirectX. Apparently, you need to point to the creation of a directX device so as not to bother with FPU precision (CreateFlags.FpuPreserve), otherwise the doubles will be treated as floating.
For more information: floating point precision
source share