This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How convert double type to float?

The time transmitted from ALLSTAR DATA SOURCE is doubletype,and wanted to display time to LCD,so I want to convert double type to float ,and want to uS.How can i do that?
Thanks a lot!

Parents
  • "How can i do that?"

    Can you provide a link to a document that describes the data output from this device, or provide a better description of it yourself?

    What exactly do you mean when you say 'double' - a 64 bit IEEE binary floating point value, an ASCII representation of a floating point value, or what?

Reply
  • "How can i do that?"

    Can you provide a link to a document that describes the data output from this device, or provide a better description of it yourself?

    What exactly do you mean when you say 'double' - a 64 bit IEEE binary floating point value, an ASCII representation of a floating point value, or what?

Children
  • Sorry ,I couldn't described the question clearly at noon.My mean is pointing to 64bits IEEE binary floating point value ,which binary structure as following:

    Double Float (64 bits )
    MSB (bit 63) = Sign
    Bit 62..52 = Exp
    Bit 51..00 = Mantissa
    2exp(-1*bit51) + 2 exp(-2*bit50).......
    Value = Sign * 1.mantissa * 2 exp(EXP-1023)

    Thanks for your help!

  • "My mean is pointing to 64bits IEEE binary floating point value"

    In that case you will have to write your own routine to convert it to a 32 bit IEEE754 float. There is a good description of the 32 bit format on this website - search for IEEE.