How do I convert a decimal number smaller than 1.0 to hex float?

Discussion in 'Computer Programming, Emulation, and Game Modding' started by CosmoCortney, May 23, 2017.

  1. CosmoCortney
    OP

    CosmoCortney The Hacker Furry

    Member
    1,549
    1,467
    Apr 18, 2013
    Germany
    on the cool side of the pillow
    Hello,
    since I know how to convert any decimal number to hex float (e.g. 1.33333333 = 0x3FAAAAAB) I still struggle with converting a decimal number smaller than 1.0 to hex float (e.g. how do I get 0x3C4CCCCD from 0.0125?)

    can anyone help me?
    thanks :)
     
  2. daxtsu

    daxtsu GBAtemp Guru

    Member
    5,546
    3,952
    Jun 9, 2007
    Antarctica
    CosmoCortney likes this.
  3. CosmoCortney
    OP

    CosmoCortney The Hacker Furry

    Member
    1,549
    1,467
    Apr 18, 2013
    Germany
    on the cool side of the pillow
    daxtsu likes this.
  4. daxtsu

    daxtsu GBAtemp Guru

    Member
    5,546
    3,952
    Jun 9, 2007
    Antarctica
    No problem. This assumes of course that the platform you're working with (Wii U? Just a guess) uses standard floats. If you require something for a weird platform like the PS2 which does not use standard floats, then you may need to search further or specify which one.
     
  5. CosmoCortney
    OP

    CosmoCortney The Hacker Furry

    Member
    1,549
    1,467
    Apr 18, 2013
    Germany
    on the cool side of the pillow
    the info given at the example of -0.5 is sufficient enough for me to understand how to convert a decimal number to any kind of IEEE floats :)
     
    daxtsu likes this.