Does Bullet rely on double precision operations?

Post Reply
1337
Posts: 3
Joined: Sat Apr 23, 2011 2:27 am

Does Bullet rely on double precision operations?

Post 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?
zarlox
Posts: 31
Joined: Tue Apr 26, 2011 5:52 pm

Re: Does Bullet rely on double precision operations?

Post 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.
1337
Posts: 3
Joined: Sat Apr 23, 2011 2:27 am

Re: Does Bullet rely on double precision operations?

Post 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.
User avatar
Erwin Coumans
Site Admin
Posts: 4235
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Does Bullet rely on double precision operations?

Post by Erwin Coumans »

No, Bullet doesn't use or rely on any double precision values by default.

Thanks,
Erwin
1337
Posts: 3
Joined: Sat Apr 23, 2011 2:27 am

Re: Does Bullet rely on double precision operations?

Post by 1337 »

Very good. Then we certainly never run into such trouble.
Thank you!
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: Does Bullet rely on double precision operations?

Post 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 ...
Post Reply