Page 1 of 1

Does Bullet rely on double precision operations?

Posted: Sat Apr 23, 2011 2:34 am
by 1337
As you may know, initialising a DirectX device sets the FPU mode to single precision per default. Even though it can be avoided, you would usually not do this for a 3D computer game.

Now when I look at the Bullet sources, I find a lot of "double" occurences (btScalar being defined as float though).
That makes me wonder: Does Bullet rely on these double values to actually behave as such? Or more precisely: Do you think single precision could break Bullet from working at all in general?

Re: Does Bullet rely on double precision operations?

Posted: Tue Apr 26, 2011 5:56 pm
by zarlox
Bullet default to single precision (float).

You can compile the library as double-precision by adding the BT_USE_DOUBLE_PRECISION definition symbol in the bullet projects. With this symbol, the btScalar type will be double precision.

(Edit)

sorry i did not read the post entirely. I do think that bullet use double internally in some places where it does need more precision. However, It should not affect the API interface to your application.

Re: Does Bullet rely on double precision operations?

Posted: Tue Apr 26, 2011 7:59 pm
by 1337
zarlox wrote:I do think that bullet use double internally in some places where it does need more precision. However, It should not affect the API interface to your application.
Let me rephrase: Does Bullet rely on these internal doubles to actually have double precision? Because in some cases they will be single precision even though defined as "double" because DirectX sets the FPU to single precision for the ENTIRE application, including all libraries. I know it sounds crazy when you hear it for the first time. But I checked: my double subtraction test was actually done with single precision.

Re: Does Bullet rely on double precision operations?

Posted: Tue Apr 26, 2011 8:34 pm
by Erwin Coumans
No, Bullet doesn't use or rely on any double precision values by default.

Thanks,
Erwin

Re: Does Bullet rely on double precision operations?

Posted: Tue Apr 26, 2011 9:29 pm
by 1337
Very good. Then we certainly never run into such trouble.
Thank you!

Re: Does Bullet rely on double precision operations?

Posted: Wed Apr 27, 2011 1:46 am
by majestik666
Not related to the original post but,
is there any place in bullet where even when compiled for doubles
bullet uses float numbers ?

I haven't had much time to look deeper into it but recently figured out
that compiling as double was giving me non-deterministic solves in some
situations and it was deterministic when compiled as float ...