home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!psgrain!qiclab!leonard
- From: leonard@qiclab.scn.rain.com (Leonard Erickson)
- Newsgroups: comp.lang.pascal
- Subject: Re: Storage of Microsoft Reals.
- Keywords: Real,Microsoft,TurboPascal
- Message-ID: <1992Nov16.045729.26623@qiclab.scn.rain.com>
- Date: 16 Nov 92 04:57:29 GMT
- Article-I.D.: qiclab.1992Nov16.045729.26623
- References: <Hendrik.Klompmaker.5.721426727@beheer.zod.wau.nl>
- Reply-To: Leonard.Erickson@f51.n105.z1.fidonet.org
- Organization: SCN Research/Qic Laboratories of Tigard, Oregon.
- Lines: 27
-
- Hendrik.Klompmaker@beheer.zod.wau.nl (Hendrik.Klompmaker) writes:
-
- >A friend asked me about the format of microsoft (quick basic) real in a
- >file. He needs to read a binary file in TP (wich uses IEEE reals) but doesn'
- >t know how the reals are stored. The files are written bye Qbasic.
-
- QuickBasic normally uses the same IEEE formats that TP does. But the
- *older* format used by GWBASIC (and BASIC/BASICA) is different.
-
- The best way to describe it is to say that it's the same as the TP
- 6-byte "REAL" format, except that the "sign/expoment" byte is at the
- other end.
-
- TP reals are 5 bytes of "mantissa" followed by an exponent byte.
- Miscrosoft single-precision is an expoment byte, followed by 3 bytes
- of mantissa. And MS Doubles are an exponenet byte followed by 7 bytes
- of mantissa. The format of the exponent bytes for all three is the same.
- And the mantissas only differe in length.
-
- So you can convert by simply shuffling a few bytes around and either
- truncating the mantissa or tacking some zero bytes onto the end as "padding".
-
- --
- Leonard Erickson leonard@qiclab.scn.rain.com
- CIS: [70465,203] 70465.203@compuserve.com
- FIDO: 1:105/51 Leonard.Erickson@f51.n105.z1.fidonet.org
- (The CIS & Fido addresses are preferred)
-