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?
Does Bullet rely on double precision operations?
-
- Posts: 31
- Joined: Tue Apr 26, 2011 5:52 pm
Re: Does Bullet rely on double precision operations?
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.
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.
-
- Posts: 3
- Joined: Sat Apr 23, 2011 2:27 am
Re: Does Bullet rely on double precision operations?
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.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.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Does Bullet rely on double precision operations?
No, Bullet doesn't use or rely on any double precision values by default.
Thanks,
Erwin
Thanks,
Erwin
-
- Posts: 3
- Joined: Sat Apr 23, 2011 2:27 am
Re: Does Bullet rely on double precision operations?
Very good. Then we certainly never run into such trouble.
Thank you!
Thank you!
-
- Posts: 66
- Joined: Tue Mar 02, 2010 6:13 am
Re: Does Bullet rely on double precision operations?
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 ...
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 ...