1 Reply Latest reply on Jul 26, 2006 10:28 AM by seth_hodgson

    AMF Serialization and floats

    TucsonJava Level 1
      I am transfering float values from Java DTOs to corresponding AS objects using both FDS and remote objects. The Java float values have a precision of 4 decimal places (verified before serialization) yet when they are created in AS they have 16 decimal places with values extending throughout the 16 digits. I suppose I can round the values when I receive them at the client, but can someone tell me if there's a better way to insure the destination values are the same as the source?

      Thanks,
      Mike
        • 1. Re: AMF Serialization and floats
          seth_hodgson Level 1
          Hi Mike,

          To serialize/deserialize data between Flash and Java symmetric data types are necessary. ActionScript and ECMAScript provide a Number datatype that equates to a Java double; it's an 8byte IEEE-754 double precision floating point value. They don't provide a 4byte float datatype.

          So your Java floats are being widened to Numbers on the client. I'd recommend using double values on the server if possible to avoid any potential mismatch.

          Regards,
          Seth