[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

32-bit floating point notation

Can anyone give a _clear_ description of how to manually convert floating point decimal numbers to 32-bit excess notation, in binary and hex? Please answer only if you can give step-by-step instructions to someone not so brilliant (me!). Thanx.
0
jaanders
Asked:
jaanders
1 Solution
 
msmitsCommented:
Maybe you can enlighten us where the 32-bit excess notation comes from and which applications use that.

0
 
Tommy HuiEngineerCommented:
If you're talking about accessing the 4 bytes of data (sizeof (float) == 4) that represents a float, then you can use something like

  float f = 3.1415;
  char* buffer = &f;

  for (int i = 0; i < sizeof(float); i++)
  {
    char ch = buffer[i];
    if (needAsHex)
      convertToHex(ch);
    else
      convertToBinary(ch);
  }

0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now