Results 1 to 6 of 6

Thread: how to store double-precision values

  1. #1
    Member
    Join Date
    Mar 2009
    Location
    Tokyo, Japan
    Posts
    88

    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:

    Code :
    <newparam>
      <float>1.151</float>
    </newparam>
    <limits>
      <min>
        <float>1.512</float>
      </min>
    </limits>

    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,
    Rosen Diankov
    Department of Mechano-Informatics, University of Tokyo
    http://openrave.org

  2. #2
    Member
    Join Date
    Mar 2009
    Location
    Tokyo, Japan
    Posts
    88

    Re: how to store double-precision values

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

    is it a violation of the standard?
    Rosen Diankov
    Department of Mechano-Informatics, University of Tokyo
    http://openrave.org

  3. #3
    Member
    Join Date
    Mar 2009
    Location
    Tokyo, Japan
    Posts
    88

    Re: how to store double-precision values

    hi guys, any ideas?
    Rosen Diankov
    Department of Mechano-Informatics, University of Tokyo
    http://openrave.org

  4. #4
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: how to store double-precision values

    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.

  5. #5
    Member
    Join Date
    Mar 2009
    Location
    Tokyo, Japan
    Posts
    88

    Re: how to store double-precision values

    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?

    thanks,
    Rosen Diankov
    Department of Mechano-Informatics, University of Tokyo
    http://openrave.org

  6. #6
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: how to store double-precision values

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •