Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pilot error or fault in Function i3efp ?

Status
Not open for further replies.

Vip7

Programmer
Aug 4, 2011
2
US
Howdy -

I built an Excel 2010 VBA application using the great FAQ routines on this forum at:

These convert IEEE 32 bit hex values to/from single (or double?) precison Excel numbers. I tried both single (32bit) and double (64 bit). I might be doing something wrong, but most times the Function i3efp(num_in) under FAQ Item # 4 works perfectly. When I say perfectly I mean it matches what I get from a nice on-line web based conversion utility at:

I find i3efp() works great for passed in values like 30, 35.5, 45, 50, and 59.1234. However, I get a mismatch with the above web tool for numbers like 35.1 and 133. Then i3efp() fails for numbers like 32, 64, and 128.

When 32 comes in, the internal "e" becomes 132, and "f" becomes 0. An "f" of zero bombs out at the second line here:
f = (Abs(num_in) / (2 ^ (e - 127))) - 1 ' f becomes 0
f = 1 * Right(f, Len(f) - 2) ' bombs out

Am I doing something wrong? Anyone have a fix?

I have put a demo spreadsheet on MediaFire, an Excel 2010 XLSM at

Thanks in advance,
Vip77
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top