Solved

32-bit floating point notation

Posted on 1997-10-05
2
221 Views
Last Modified: 2013-12-03
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
Comment
Question by:jaanders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Expert Comment

by:msmits
ID: 1407244
Maybe you can enlighten us where the 32-bit excess notation comes from and which applications use that.

0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 300 total points
ID: 1407245
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question