Article View: comp.os.msdos.programmer
Article #7863Re: Microsoft Binary Format
From: Glen Blankenship
Date: Mon, 21 Aug 1995 17:31
Date: Mon, 21 Aug 1995 17:31
40 lines
1870 bytes
1870 bytes
[Followups have been trimmed to comp.os.msdos.programmer]
Fred Charles Merkel (merkel@dolphin.upenn.edu) wrote:
> I just received a huge chunk of data in "Microsoft Binary Format". The
> data are in four byte words, but they don't seem to correspond to normal
> floats or ints.
>
> Does anyone know what MBF is or can anyone give me some pointers to finding
> out more?
Microsoft's C compilers include runtime library functions to convert
between MBF and IEEE floating-point formats. If you have four-byte
MBF numbers, the function you need is _fmsbintoieee(). For eight-byte
double-precision MBF numbers, you'd use _dmsbintoieee().
Borland's compilers don't include these functions in their runtime
library, but C source to implement these functions can be obtained
from:
ftp://ftp.borland.com/pub/techinfo/techdocs/language/c++/bcpp/msbin.zip
Note, however, that there's a slight bug in Borland's implementation
of _fmsbintoieee().
The lines:
/* any msbin w/ exponent of zero = zero */
if (msbin[3] == 0) return 0;
...should be changed to:
/* any msbin w/ exponent of zero = zero, and any msbin
w/ exponent < 2 is too small to represent in IEEE format */
if (msbin[3] < 2) return 0;
...otherwise very small numbers will produce erroneous results.
---
Glen Blankenship
obother@netcom.com
Technical Details
Message-ID:
<obotherDDo8oz.JIr@netcom.com>Path:
arc1-ca.pugleaf.net!netcom.com!obotherReferences:
<41a5ft$hfi@netnews.upenn.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer,comp.os.msdos.misc,comp.os.ms-windows.programmer,comp.lang.c,comp.lang.pascal Path: arc1-ca.pugleaf.net!netcom.com!obother From: obother@netcom.com (Glen Blankenship) Subject: Re: Microsoft Binary Format Message-ID: <obotherDDo8oz.JIr@netcom.com> Followup-To: comp.os.msdos.programmer Organization: Church of the Holy Toy X-Newsreader: TIN [version 1.2 PL1] References: <41a5ft$hfi@netnews.upenn.edu> Date: Mon, 21 Aug 1995 17:31:47 GMT Sender: obother@netcom14.netcom.com