Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


A661_ROTATION_ANGLE - How is the float packed?

  • Looking at the communication between the client/server I am unsure how its packing the float data.

    For example here is a message for rotating something to 15 degrees

    The important part is the 0x0aaaaab0 which is the 4byte parameter for the rotation angle action or 0xb410. However that doesn't seem to make sense using:

    And inputting 15 degrees you get 0x41700000,

    This site:

    Gives the same number of 0x41700000 so I am not sure where the 0x0AAAAAAB0 came from.. I have tried other angles like -15 or 1 or 45 or 90 and I can't seem to figure out how its packing them.

    In the code it seems like its using this public void setFloatParameter(int widgetID, String paramID, float value)

    But I can't find anything in that call tree that would explain it, or I am just not seeing it.

    EDIT: Btw I tried degrees -> radians and that didn't seem to help either.

    Last edit: Howard Martinez 2014-04-14
  • Tried some more values, and its just not lining up there is obviously something I am missing here.
    INPUT IEEE 754 661
    -45 Degrees = 0xc2340000 = 0xE0000000
    -15 Degrees = 0xc1700000 = 0xF5555550
    -5 Degrees = 0xc0a00000 = 0xFC71C71C
    0 Degrees = 0x00000000 = 0x00000000
    5 Degrees = 0x40a00000 = 0x038E38E4
    15 Degrees = 0x41700000 = 0x0AAAAAB0
    45 Degrees = 0x42340000 = 0x20000000
    13.2 Degrees = 0x41533333 = 0x0962FC90

    Last edit: Howard Martinez 2014-04-15
  • NVM I found it.. its a 2's complement packed fr(180) type int form of a float. That's strange but it works I guess.

  • Hervé Girod
    Hervé Girod

    Sorry, I was away ;)

    Yes, a lot of "float" parameters are in fact coded in fr(180) (for angles), fr(1) (for ratios with 1 as maximum value) or fr(32768) (for distance in m). There are still some real float values, such as for EditBoxNumeric values.

    The reason work they did this was to have the maximum precision for values whose minimum and maximum are fixed, but I agree that having only float values in all cases would have been simpler ;)

    Last edit: Hervé Girod 2014-04-15


Cancel   Add attachments