How to properly enable double precision?

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

How to properly enable double precision?

Postby AntonSynytsia » Sat Nov 22, 2014 5:33 pm

I write this piece of code in Newton.h to use doubles:
#define _NEWTON_USE_DOUBLE

Compiling it doesn't seem to succeed - I get various errors involving wrong type cast...

Is the double future still not implemented, or am I defining it in wrong file?
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: How to properly enable double precision?

Postby r4mon » Fri Nov 28, 2014 3:35 pm

The FP types are defined in a few different places (Newton.h, dgTypes.h and dMathDefines.h) and there are a few other files that also check for _NEWTON_USE_DOUBLE (and a couple that are still checking for __USE_DOUBLE_PRECISION__). The project files aren't setup in a way that makes it easy for you to add the flag to all projects and configurations, so for now adding the flag to the header files is probably easier (though messier).

But just getting the flag defined properly will still only get you a broken build, as it seems double precision support was left behind, with a few direct "float" references and the new move towards AMP which currently simply ignores the possibility of the engine using double precision.

I've spent some time working on the source of the pre-AMP commits, and while I've managed to massage it enough to compile, the vector math is broken somewhere non-obvious. It doesn't help that the code likes to do bitwise operations on floating point numbers, but even with all masks I could find updated to 64-bit doubles, the code is still hitting asserts where it shouldn't (specifically, bounding box min > max).

I'd like to know as well if double precision is going to get any support in the future, as I was looking at Newton with the intent of using it on a project where double precision support is required.
r4mon
 
Posts: 1
Joined: Fri Nov 28, 2014 3:20 pm

Re: How to properly enable double precision?

Postby AntonSynytsia » Fri Nov 28, 2014 11:17 pm

Thanks for you insight r4mon.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 3 guests

cron