Not double floats, just single floats(32 bit).
I’ve previously read that java has greater FP accuracy than C*(’*’ = wildmark for C, C++ and C#).
This might be what I’m seeing, however I would like clarification if this indeed is the case.
My test was done using LWJGL’s math class.
All the test invovled was using vector3f’s in order to do an orthogonal projection from one vector onto the same vector without the Y-COORD.
IE: vec(x, y, z) is projected onto vec(x, 0, z).
I’ve written my own vector class in C++ for my assignment, it uses floats and does the EXACT same operations as LWJGL’s math class does because there really is only one method of working with vectors.
Anyway, the reason I projected (x, y, z) onto (x, 0, z) is to map the point onto a 3D sphere.
The sphere’s equation must satisfy the following condition:
xx + yy + z*z = 1.
NOTE:
After doing all my computation and making sure the intermediate calculations do the EXACT same thing in both libraries(my own and LWJGL’s) I’ve come up with 2 results.
C++: 1.000000.
Java: 0.9999995.
So is Java more accurate or less accurate?
Do I need to floor Java’s result after every normalised vector operation?