how to store double-precision values

we need to store more accurate values for the kinematics spec of collada. A lot of the tags look like:


The problem is that the collada-dom library casts these values to 32bit floats (as opposed to 64bit), and we lose valuable precision. My question is:

Does the collada spec demand 32bit floats to be stored? If so, how can we specify doubles? If not, should collada-dom be updated to store doubles instead?

thank you,

is it ok to convert all of collada-dom kinematic spec’s float values to double-precision?

is it a violation of the standard?

hi guys, any ideas?

Hi Rosan,

Yes you can use double precision floats. The COLLADA int and float types, in general, are inherently 64-bit friendly using XSD long and double types in the schema. You should use the float_array attributes to indicate that you have greater precision in the values that should be honored.

Also be aware that single-precision implementations may truncate the precision of your document’s values. The meta data is there to inform software of 64 bit values, but 32-bit implemenations are the norm.

hi marcus,

thanks for the reply. i will add a double precision option for the next collada-dom release and make releases for both 32bit and 64bit.

i’m not sure i understand how i can specify XSD. can you give an example in collada where values in <translate> and <rotate> tags are specified as 64bit precision?


Hi Rosan,

The COLLADA <float_array> and <int_array> elements can hold 64 bit equivalent values. They each provide attributes that signal greater then 32 bit precision. E.g.

<float_array digiits=“15” magnitude=“308” />
<int_array minInclusive="-9223372036854775808" maxInclusive=“9223372036854775807” />

Again please note that 32-bit implementatations would truncate the values although good ones that handle the attributes (or detected under/over flow) would be able to warn of data loss.