Article View: comp.os.msdos.programmer
Article #611Re: MS BASIC Real Data Type Structure?
From: Leonard Erickson
Date: Wed, 08 Apr 1992 03:15
Date: Wed, 08 Apr 1992 03:15
27 lines
1844 bytes
1844 bytes
pacheco@acs.harding.edu writes: >Does anyone know the format for the 4 byte floating point data type (the >single precision real) in MS BASIC? I specifically need a routine to >convert these values to IEEE 4 byte floating point values. If you know >the details of the data type and/or you have any code (C, Pascal, ASM) >which operates on them, I would truly appreciate any assistance you >could offer. Thanks ... If you have a Turbo Pascal manual, look up the format of the REAL type (6 bytes long). you'll see 5 bytes of mantissa, with one byte of exponent on the end. What's this got to do with BASIC? Take the exponent byte and move it to the other (most significant) end of the structure. Now chop the last two byte (least significant) of the end the exponent *used* to be at. You now have the BASIC 4-byte format. I was converting TP 6-byte reals to BASIC 4-byte reals by *exactly* the method described above. It should work fine in the other direction too. Just take a good look at the explanation of the TP structure and my explanation above and you should get the idea. -- Leonard Erickson leonard@qiclab.scn.rain.com CIS: [70465,203] 70465.203@compuserve.com FIDO: 1:105/56 Leonard.Erickson@f56.n105.z1.fidonet.org (The CIS address is checked daily. The others infrequently)
Technical Details
Message-ID:
<1992Apr8.031534.25817@qiclab.scn.rain.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!rpi!usenet.coe.montana.edu!ogicse!psgrain!qiclab!leonardReferences:
<1992Mar29.223636.459@ualr.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!rpi!usenet.coe.montana.edu!ogicse!psgrain!qiclab!leonard From: leonard@qiclab.scn.rain.com (Leonard Erickson) Newsgroups: comp.os.msdos.programmer Subject: Re: MS BASIC Real Data Type Structure? Message-ID: <1992Apr8.031534.25817@qiclab.scn.rain.com> Date: 8 Apr 92 03:15:34 GMT Article-I.D.: qiclab.1992Apr8.031534.25817 References: <1992Mar29.223636.459@ualr.edu> Reply-To: 70465.203@compuserve.com Organization: SCN Research/Qic Laboratories of Tigard, Oregon. Lines: 27