Microsoft Binary Format

Last updated

In computing, Microsoft Binary Format (MBF) is a format for floating-point numbers which was used in Microsoft's BASIC languages, including MBASIC, GW-BASIC and QuickBASIC prior to version 4.00. [1] [2] [3] [4] [5] [6] [7]

Contents

There are two main versions of the format. The original version was designed for memory-constrained systems and stored numbers in 32 bits (4 bytes), with a 23-bit mantissa, 1-bit sign, and an 8-bit exponent. Extended (12k) BASIC included a double-precision type with 64 bits.

During the period when it was being ported from the Intel 8080 platform to the MOS 6502 processor, computers were beginning to ship with more memory as a standard feature. This version was offered with the original 32-bit format or an optional expanded 40-bit (5-byte) format. The 40-bit format was used by most home computers of the 1970s and 1980s. These two versions are sometimes known as "6-digit" and "9-digit", respectively. [8]

On PCs with x86 processor, QuickBASIC, prior to version 4, reintroduced the double-precision format using a 55-bit mantissa in a 64-bit (8-byte) format. MBF was abandoned during the move to QuickBASIC 4, which used the standard IEEE 754 format, introduced a few years earlier.

History

Bill Gates and Paul Allen were working on Altair BASIC in 1975. They were developing the software at Harvard University on a DEC PDP-10 running their Altair emulator. [9] One thing they lacked was code to handle floating-point numbers, required to support calculations with very big and very small numbers, [9] which would be particularly useful for science and engineering. [10] [11] One of the proposed uses of the Altair was as a scientific calculator. [12]

Altair 8800 front panel Altair 8800 at the Computer History Museum, cropped.jpg
Altair 8800 front panel

At a dinner at Currier House, an undergraduate residential house at Harvard, Gates and Allen complained to their dinner companions that they had to write this code [9] and one of them, Monte Davidoff, told them that he had written floating-point routines before and convinced Gates and Allen that he was capable of writing the Altair BASIC floating-point code. [9] At the time, while IBM had introduced their own programs, there was no standard for floating-point numbers, so Davidoff had to come up with his own. He decided that 32 bits would allow enough range and precision. [13] When Allen had to demonstrate it to MITS, it was the first time it ran on an actual Altair. [14] But it worked, and when he entered ‘PRINT 2+2’, Davidoff's adding routine gave the correct answer. [9]

A copy of the source code for Altair BASIC resurfaced in 1999. In the late 1970s, Gates's former tutor and dean Harry Lewis had found it behind some furniture in an office in Aiden, and put it in a file cabinet. After more or less forgetting about its existence for a long time, Lewis eventually came up with the idea of displaying the listing in the lobby. Instead, it was decided on preserving the original listing and producing several copies for display and preservation, after librarian and conservator Janice Merrill-Oldham pointed out its importance. [15] [16] A comment in the source credits Davidoff as the writer of Altair BASIC's math package. [15] [16]

Radio Shack Tandy TRS-80 Model I System Radio Shack Tandy TRS-80 Model I System.JPG
Radio Shack Tandy TRS-80 Model I System

Altair BASIC took off, and soon most early home computers ran some form of Microsoft BASIC. [17] [18] The BASIC port for the 6502 CPU, such as used in the Commodore PET, took up more space due to the lower code density of the 6502. Because of this it would likely not fit in a single ROM chip together with the machine-specific input and output code. Since an extra chip was necessary, extra space was available, and this was used in part to extend the floating-point format from 32 to 40 bits. [8] This extended format was not only provided by Commodore BASIC 1 & 2, but was also supported by Applesoft BASIC I & II since version 1.1 (1977), KIM-1 BASIC since version 1.1a (1977), and MicroTAN BASIC since version 2b (1980). [8] Not long afterwards, the Z80 ports, such as Level II BASIC for the TRS-80 (1978), introduced the 64-bit, double-precision format as a separate data type from 32-bit, single-precision. [19] [20] [21] Microsoft used the same floating-point formats in their implementation of Fortran [22] and for their macro assembler MASM, [23] although their spreadsheet Multiplan [24] [25] and their COBOL implementation used binary-coded decimal (BCD) floating point. [26] Even so, for a while MBF became the de facto floating-point format on home computers, to the point where people still occasionally encounter legacy files and file formats using it. [27] [28] [29] [30] [31] [32]

VAX-11/780 minicomputer VAX 11-780 intero.jpg
VAX-11/780 minicomputer

In a parallel development, Intel had started the development of a floating-point coprocessor in 1976. [33] [34] William Morton Kahan, as a consultant to Intel, suggested that Intel use the floating point of Digital Equipment Corporation's (DEC) VAX. The first VAX, the VAX-11/780 had just come out in late 1977, and its floating point was highly regarded. VAX's floating-point formats differed from MBF only in that it had the sign in the most significant bit. [35] [36] However, seeking to market their chip to the broadest possible market, Kahan was asked to draw up specifications. [33] When rumours of Intel's new chip reached its competitors, they started a standardization effort, called IEEE 754, to prevent Intel from gaining too much ground. As an 8-bit exponent was not wide enough for some operations desired for double-precision numbers, e.g. to store the product of two 32-bit numbers, [1] Intel's proposal and a counter-proposal from DEC used 11 bits, like the time-tested 60-bit floating-point format of the CDC 6600 from 1965. [34] [37] [38] Kahan's proposal also provided for infinities, which are useful when dealing with division-by-zero conditions; not-a-number values, which are useful when dealing with invalid operations; denormal numbers, which help mitigate problems caused by underflow; [37] [39] [40] and a better balanced exponent bias, which could help avoid overflow and underflow when taking the reciprocal of a number. [41] [42]

By the time QuickBASIC 4.00 was released,[ when? ] the IEEE 754 standard had become widely adoptedfor example, it was incorporated into Intel's 387 coprocessor and every x86 processor from the 486 on. QuickBASIC versions 4.0 and 4.5 use IEEE 754 floating-point variables by default, but (at least in version 4.5) there is a command-line option /MBF for the IDE and the compiler that switches from IEEE to MBF floating-point numbers, to support earlier-written programs that rely on details of the MBF data formats. Visual Basic also uses the IEEE 754 format instead of MBF.

Technical details

MBF numbers consist of an 8-bit base-2 exponent, a sign bit (positive mantissa: s = 0; negative mantissa: s = 1) and a 23-, [43] [8] 31- [8] or 55-bit [43] mantissa of the significand. There is always a 1-bit implied to the left of the explicit mantissa, and the radix point is located before this assumed bit. The exponent is encoded with a bias of 128[ citation needed ], so that exponents −127…−1[ citation needed ] are represented by x = 1…127 (01h…7Fh)[ citation needed ], exponents 0…127[ citation needed ] are represented by x = 128…255 (80h…FFh)[ citation needed ], with a special case for x = 0 (00h) representing the whole number being zero.

The MBF double-precision format provides less scale than the IEEE 754 format, and although the format itself provides almost one extra decimal digit of precision, in practice the stored values are less accurate because IEEE calculations use 80-bit intermediate results, and MBF doesn't. [1] [3] [43] [44] Unlike IEEE floating point, MBF doesn't support denormal numbers, infinities or NaNs. [45]

MBF single-precision format (32 bits, "6-digit BASIC"): [43] [8]

ExponentSignSignificand
8 bits,
bit 31–24
1 bit,
bit 23
23 bits,
bit 22–0
xxxxxxxxsmmmmmmmmmmmmmmmmmmmmmmm

MBF extended-precision format (40 bits, "9-digit BASIC"): [8]

ExponentSignSignificand
8 bits,
bit 39–32
1 bit,
bit 31
31 bits,
bit 30–0
xxxxxxxxsmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

MBF double-precision format (64 bits): [43] [1]

ExponentSignSignificand
8 bits,
bit 63–56
1 bit,
bit 55
55 bits,
bit 54–0
xxxxxxxxsmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

Examples

32-bit format: 84h, 20h, 00h, 00h
40-bit format: 84h, 20h, 00h, 00h, 00h
32-bit format: 82h, 00h, 00h, 00h
40-bit format: 82h, 00h, 00h, 00h, 00h
32-bit format: 81h, 00h, 00h, 00h
40-bit format: 81h, 00h, 00h, 00h, 00h
32-bit format: 00h, 00h, 00h, 00h (or 00h, xxh, xxh, xxh)
40-bit format: 00h, 00h, 00h, 00h, 00h (or 00h, xxh, xxh, xxh, xxh)
32-bit format: 80h, 00h, 00h, 00h
40-bit format: 80h, 00h, 00h, 00h, 00h
32-bit format: 7Fh, 00h, 00h, 00h
40-bit format: 7Fh, 00h, 00h, 00h, 00h
32-bit format: 80h, 80h, 00h, 00h
40-bit format: 80h, 80h, 00h, 00h, 00h
32-bit format: 80h, 35h, 04h, F3h
40-bit format: 80h, 35h, 04h, F3h, 34h
32-bit format: 81h, 35h, 04h, F3h
40-bit format: 81h, 35h, 04h, F3h, 34h
32-bit format: 80h, 31h, 72h, 18h
40-bit format: 80h, 31h, 72h, 17h, F8h
32-bit format: 81h, 38h, AAh, 3Bh
40-bit format: 81h, 38h, AAh, 3Bh, 29h
32-bit format: 81h, 49h, 0Fh, DBh
40-bit format: 81h, 49h, 0Fh, DAh, A2h
32-bit format: 83h, 49h, 0Fh, DBh
40-bit format: 83h, 49h, 0Fh, DAh, A2h

See also

Related Research Articles

<span class="mw-page-title-main">Floating-point arithmetic</span> Computer approximation for real numbers

In computing, floating-point arithmetic (FP) is arithmetic that represents subsets of real numbers using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. Numbers of this form are called floating-point numbers. For example, 12.345 is a floating-point number in base ten with five digits of precision:

IEEE 754-1985 is a historic industry standard for representing floating-point numbers in computers, officially adopted in 1985 and superseded in 2008 by IEEE 754-2008, and then again in 2019 by minor revision IEEE 754-2019. During its 23 years, it was the most widely used format for floating-point computation. It was implemented in software, in the form of floating-point libraries, and in hardware, in the instructions of many CPUs and FPUs. The first integrated circuit to implement the draft of what was to become IEEE 754-1985 was the Intel 8087.

Double-precision floating-point format is a floating-point number format, usually occupying 64 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point.

In computer science, subnormal numbers are the subset of denormalized numbers that fill the underflow gap around zero in floating-point arithmetic. Any non-zero number with magnitude smaller than the smallest positive normal number is subnormal, while denormal can also refer to numbers outside that range.

Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first version of BASIC published by Microsoft as well as the first high-level programming language available for the Altair 8800 microcomputer.

The IEEE Standard for Floating-Point Arithmetic is a technical standard for floating-point arithmetic established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). The standard addressed many problems found in the diverse floating-point implementations that made them difficult to use reliably and portably. Many hardware floating-point units use the IEEE 754 standard.

The significand refers to the first (left) part of a number in scientific notation or related concepts in floating-point representation, consisting of its significant digits. Depending on the interpretation of the exponent, the significand may represent an integer or a fraction.

Hexadecimal floating point is a format for encoding floating-point numbers first introduced on the IBM System/360 computers, and supported on subsequent machines based on that architecture, as well as machines which were intended to be application-compatible with System/360.

In C and related programming languages, long double refers to a floating-point data type that is often more precise than double precision though the language standard only requires it to be at least as precise as double. As with C's other floating-point types, it may not necessarily map to an IEEE format.

In computing, minifloats are floating-point values represented with very few bits. Predictably, they are not well suited for general-purpose numerical calculations. They are used for special purposes, most often in computer graphics, where iterations are small and precision has aesthetic effects. Machine learning also uses similar formats like bfloat16. Additionally, they are frequently encountered as a pedagogical tool in computer-science courses to demonstrate the properties and structures of floating-point arithmetic and IEEE 754 numbers.

Extended precision refers to floating-point number formats that provide greater precision than the basic floating-point formats. Extended precision formats support a basic format by minimizing roundoff and overflow errors in intermediate values of expressions on the base format. In contrast to extended precision, arbitrary-precision arithmetic refers to implementations of much larger numeric types using special software.

RGBE or Radiance HDR is an image format invented by Gregory Ward Larson for the Radiance rendering system. It stores pixels as one byte each for RGB values with a one byte shared exponent. Thus it stores four bytes per pixel.

<span class="mw-page-title-main">Decimal computer</span> Computer operating on base-10 numbers

A decimal computer is a computer that can represent numbers and addresses in decimal and that provides instructions to operate on those numbers and addresses directly in decimal, without conversion to a pure binary representation. Some also had a variable wordlength, which enabled operations on numbers with a large number of digits.

Offset binary, also referred to as excess-K, excess-N, excess-e, excess code or biased representation, is a method for signed number representation where a signed number n is represented by the bit pattern corresponding to the unsigned number n+K, K being the biasing value or offset. There is no standard for offset binary, but most often the K for an n-bit binary word is K = 2n−1 (for example, the offset for a four-digit binary number would be 23=8). This has the consequence that the minimal negative value is represented by all-zeros, the "zero" value is represented by a 1 in the most significant bit and zero in all other bits, and the maximal positive value is represented by all-ones (conveniently, this is the same as using two's complement but with the most significant bit inverted). It also has the consequence that in a logical comparison operation, one gets the same result as with a true form numerical comparison operation, whereas, in two's complement notation a logical comparison will agree with true form numerical comparison operation if and only if the numbers being compared have the same sign. Otherwise the sense of the comparison will be inverted, with all negative values being taken as being larger than all positive values.

In computing, half precision is a binary floating-point computer number format that occupies 16 bits in computer memory. It is intended for storage of floating-point values in applications where higher precision is not essential, in particular image processing and neural networks.

In computing, quadruple precision is a binary floating-point–based computer number format that occupies 16 bytes with precision at least twice the 53-bit double precision.

Single-precision floating-point format is a computer number format, usually occupying 32 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point.

The bfloat16 floating-point format is a computer number format occupying 16 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point. This format is a shortened (16-bit) version of the 32-bit IEEE 754 single-precision floating-point format (binary32) with the intent of accelerating machine learning and near-sensor computing. It preserves the approximate dynamic range of 32-bit floating-point numbers by retaining 8 exponent bits, but supports only an 8-bit precision rather than the 24-bit significand of the binary32 format. More so than single-precision 32-bit floating-point numbers, bfloat16 numbers are unsuitable for integer calculations, but this is not their intended use. Bfloat16 is used to reduce the storage requirements and increase the calculation speed of machine learning algorithms.

SCELBAL, short for SCientific ELementary BAsic Language, is a version of the BASIC programming language released in 1976 for the SCELBI and other early Intel 8008 and 8080-based microcomputers like the Mark-8. Later add-ons to the language included an extended math package and string handling. The original version required 8 kB of RAM, while the additions demanded at least 12 kB.

<span class="mw-page-title-main">BASIC interpreter</span> Interpreter that enables users to enter and run programs in the BASIC language

A BASIC interpreter is an interpreter that enables users to enter and run programs in the BASIC language and was, for the first part of the microcomputer era, the default application that computers would launch. Users were expected to use the BASIC interpreter to type in programs or to load programs from storage.

References

  1. 1 2 3 4 "IEEE vs. Microsoft Binary Format; Rounding Issues (Complete)". Microsoft Support. Microsoft. 2006-11-21. Article ID KB35826, Q35826. Archived from the original on 2020-08-28. Retrieved 2010-02-24.
  2. "(Complete) Tutorial to Understand IEEE Floating-Point Errors". Knowledge Base. Microsoft. 2005-08-16. Article ID KB42980, Q42980. Archived from the original on 2020-08-28. Retrieved 2016-06-02.
  3. 1 2 "Convert pre-IEEE-754 C++ floating-point numbers to/from C#". stackoverflow.com. 2010-04-21. Archived from the original on 2020-08-28. Retrieved 2016-06-02. (NB. The second reference could be mistaken to say that QB 4.0 could use MBF internally, but it only uses IEEE. It just has a few conversion functions to convert IEEE floating point numbers to strings containing MBF data, e.g. MKDMBF$ in addition to MKD$ which just copies the bytes of the IEEE value to a string.)
  4. "The MASM 6.1 documentation notes that 5.1 was the last MASM version to support MBF" (PDF). people.sju.edu. Retrieved 2016-06-02.
  5. GW-BASIC User's Manual, Appendix D.3 USR Function Calls.
  6. BASIC Second edition (May 1982), IBM: Appendix C-15 (NB. This is the BASICA manual).
  7. "ROM Routes (Integer Math)". Trs-80.com. Retrieved 2016-06-02.
  8. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Steil, Michael (2008-10-20). "Create your own Version of Microsoft BASIC for 6502". pagetable.com. Archived from the original on 2016-05-30. Retrieved 2016-05-30.
  9. 1 2 3 4 5 Isaacson, Walter (2013-09-20). "Dawn of a revolution". Harvard Gazette . news.harvard.edu. Archived from the original on 2020-08-28. Retrieved 2016-05-30.
  10. Rall, Louis B. (1987). "An introduction to the scientific computing language Pascal-SC" (PDF). Computers & Mathematics with Applications . 14 (1). Mathematics Research Center, University of Wisconsin-Madison, Madison, Wisconsin: Pergamon Journals Ltd: 53–69. doi: 10.1016/0898-1221(87)90181-7 . Archived from the original on 2020-08-28. Retrieved 2020-08-28. (17 pages)
  11. Leung, K. Ming (2005-02-03) [2000]. "Floating-Point Numbers in Digital Computers" (PDF). cis.poly.edu. Department of Computer and Information Science, Polytechnic University. Archived (PDF) from the original on 2018-12-14. Retrieved 2016-06-02.
  12. Becraft, Michael B. (2014-08-26). Bill Gates: A Biography. ISBN   978-1-44083014-3 . Retrieved 2016-05-30.
  13. "The Math Package". altairbasic.org. 2014. Archived from the original on 2020-08-28. Retrieved 2016-05-30. (NB. Altair BASIC 3.2 (4K Edition).)
  14. Orlowski, Andrew (2001-05-11). "Microsoft Altair BASIC legend talks about Linux, CPRM and that very frightening photo - A very rare interview with Monte Davidoff". The Register . Archived from the original on 2020-08-28. Retrieved 2016-05-30.
  15. 1 2 Orlowski, Andrew (2001-05-13). "Raiders of the Lost Altair BASIC Source Code - They came, they saw … they disassembled". The Register . Archived from the original on 2020-08-28. Retrieved 2016-05-30.
  16. 1 2 Griffiths, Ian (2000-05-08). "Quest for the Holy Source - Ian's trip to Harvard". Archived from the original on 2002-01-02. Retrieved 2016-05-30.
  17. "Great people personally responsible for advancing the art of early computers". Oldcomputers.net. 2020-07-18. Archived from the original on 2020-08-28. Retrieved 2016-05-30.
  18. "Basic 7.0 for Windows". comp.lang.basic.powerbasic.narkive.com. Archived from the original on 2020-08-28. Retrieved 2016-05-30.
  19. Radio Shack Hardware Manual: Level II BASIC Reference Manual (1 ed.). Fort Worth, Texas: Radio Shack. 1978. Archived from the original on 2020-08-28. Retrieved 2016-05-30.
  20. Level II BASIC Reference Manual (PDF). Radio Shack. 1979. Retrieved 2016-06-02.{{cite book}}: |website= ignored (help)
  21. BASIC-80 (MBASIC) Reference Manual (PDF). Retrieved 2016-05-30.
  22. Microsoft FORTRAN-80 Version 3.4 Users Manual (PDF). November 1980. pp. 45, 55. Retrieved 2016-05-30.{{cite book}}: |website= ignored (help)
  23. Pätzold, Michael, ed. (April 1993). "Zettelsammlung MS-DOS und AT" (in German). Gruppe Datenverarbeitung am MPI für Strömungsforschung Göttingen, Max-Planck-Institut. Archived from the original on 2005-02-20. Retrieved 2015-10-07.
  24. "Tandy 200 Multiplan Manual" (PDF). classiccmp.org. Retrieved 2016-06-02.
  25. Microsoft C Pcode Specifications, page 13. (NB. Multiplan wasn't compiled to machine code, but to a kind of byte-code which was run by an interpreter, in order to make Multiplan portable across the widely varying hardware of the time. This byte-code distinguished between the machine-specific floating point format to calculate on, and an external (standard) format, which was binary-coded decimal (BCD). The PACK and UNPACK instructions converted between the two.)
  26. Microsoft COBOL-80 (PDF). 1978. pp. 26, 32. Retrieved 2016-05-30.{{cite book}}: |website= ignored (help)
  27. Lee, Patrick Y. "QWK Mail Packet File Layout" (TXT). textfiles.com. Retrieved 2016-06-02.
  28. "CSI Millennium (CSIM) format with CSI Y2K extensions". csidata.com. Boca Raton, Florida: Commodity Systems, Inc. 1998-11-17. Archived from the original (TXT) on 2016-03-05. Retrieved 2016-06-02. […] This document describes the abandoned CompuTrac data format, which until recently was actively used by Equis' MetaStock charting software. […]
  29. Billard, Russ (2016-05-04) [2001-07-13]. "Converting Microsoft Binary Format to IEEE format Using VB 6". Archived from the original on 2020-08-28. Retrieved 2016-05-30.
  30. JerMyster (2003-07-02). "Help !Anybody know how to convert old M/S MBF value from Qbasic to VB6". Tek-Tips. Visual Basic (Classic) Forum. Archived from the original on 2020-08-28. Retrieved 2016-05-30.
  31. GL88. "Reading Binary Format (QBasic) with C#". Social.msdn.microsoft.com. Retrieved 2016-05-30.{{cite web}}: CS1 maint: numeric names: authors list (link)
  32. "Rmetrics - Reading MetaStock data format in R". R.789695.n4.nabble.com. 2013-09-30. Retrieved 2016-05-30.
  33. 1 2 "Intel and Floating-Point - Updating One of the Industry's Most Successful Standards - The Technology Vision for the Floating-Point Standard" (PDF). Intel. 2016. Archived from the original (PDF) on 2016-03-04. Retrieved 2016-05-30. (11 pages)
  34. 1 2 "An Interview with the Old Man of Floating-Point". cs.berkeley.edu. 1998-02-20. Retrieved 2016-05-30.
  35. "VAX Floating Point Numbers". nssdc.gsfc.nasa.gov. Archived from the original on 2020-08-28. Retrieved 2016-06-02. (NB. The VAX-11/780 did not implement the "G" format yet. Although this is not directly apparent from the tables because the structures have been cut up in two-byte words, the byte order is actually the same as on modern CPUs. There isn't enough room in the exponent range for NaNs, Infinity, infinities or denormals.)
  36. "VAX11 780" (PDF). Ece.cmu.edu. Retrieved 2016-06-02.
  37. 1 2 "IEEE 754: An Interview with William Kahan" (PDF). dr-chuck.com. Retrieved 2016-06-02.
  38. Thornton, James E. (1970). Written at Advanced Design Laboratory, Control Data Corporation. Design of a Computer: The Control Data 6600 (PDF) (1 ed.). Glenview, Illinois: Scott, Foresman and Company. LCCN   74-96462. Archived (PDF) from the original on 2020-08-28. Retrieved 2016-06-02. (1+13+181+2+2 pages)
  39. Kahan, William Morton. "Why do we need a floating-point arithmetic standard?" (PDF). cs.berkeley.edu. Retrieved 2016-06-02.
  40. Kahan, William Morton; Darcy, Joseph D. "How Java's Floating-Point Hurts Everyone Everywhere" (PDF). cs.berkeley.edu. Retrieved 2016-06-02.
  41. Turner, Peter R. (2013-12-21). Numerical Analysis and Parallel Processing: Lectures given at The Lancaster …. ISBN   978-3-66239812-8 . Retrieved 2016-05-30.
  42. "Names for Standardized Floating-Point Formats" (PDF). cs.berkeley.edu. Retrieved 2016-06-02.
  43. 1 2 3 4 5 6 Borland staff (1998-07-02) [1994-03-10]. "Converting between Microsoft Binary and IEEE formats". Technical Information Database (TI1431C.txt). Embarcadero USA / Inprise (originally: Borland). ID 1400. Archived from the original on 2019-02-20. Retrieved 2016-05-30. […] _fmsbintoieee(float *src4, float *dest4) […] MS Binary Format […] byte order => m3 | m2 | m1 | exponent […] m1 is most significant byte => sbbb|bbbb […] m3 is the least significant byte […] m = mantissa byte […] s = sign bit […] b = bit […] MBF is bias 128 and IEEE is bias 127. […] MBF places the decimal point before the assumed bit, while IEEE places the decimal point after the assumed bit. […] ieee_exp = msbin[3] - 2; /* actually, msbin[3]-1-128+127 */ […] _dmsbintoieee(double *src8, double *dest8) […] MS Binary Format […] byte order => m7 | m6 | m5 | m4 | m3 | m2 | m1 | exponent […] m1 is most significant byte => smmm|mmmm […] m7 is the least significant byte […] MBF is bias 128 and IEEE is bias 1023. […] MBF places the decimal point before the assumed bit, while IEEE places the decimal point after the assumed bit. […] ieee_exp = msbin[7] - 128 - 1 + 1023; […]
  44. "Google Groups". Groups.google.com. Retrieved 2016-06-02.
  45. Bucknall, Julian M. (2018-11-03) [2007-10-23]. "Understanding single precision MBF". boyet.com. Archived from the original on 2019-02-20. Retrieved 2016-05-30. […] IEEE 754 Single format […] The exponent is biased by 127. There is an assumed 1 bit before the radix point (so the assumed mantissa is 1.ffff… where f's are the fraction bits) […] Microsoft Binary Format (single precision) […] The exponent is biased by 128. There is an assumed 1 bit after the radix point (so the assumed mantissa is 0.1ffff… where f's are the fraction bits) […] the IEEE mantissa is twice the MBF mantissa. […] to convert from MBF to IEEE single […] subtract 2 from the exponent (one for the bias change, one for the mantissa factor), and then rearrange the sign and exponent bits. The fraction does not change. To convert from IEEE single to MBF, […] add 2 to the exponent (one for the bias change, one for the mantissa factor), and then rearrange the sign and exponent bits. The fraction does not change. […]
  46. 1 2 3 4 5 6 7 8 Steil, Michael, ed. (2008-10-20). "msbasic/float.s". MIST64. Archived from the original on 2020-08-28. Retrieved 2020-08-28 via github.com. (NB. Commented 6502 disassembly listings, merged from several versions of Microsoft BASIC for 6502 between 1977 and 1982 to recreate byte-exact copies of the original ROMs for 10 different machines from different vendors.)
  47. 1 2 3 Steil, Michael, ed. (2008-10-20). "msbasic/trig.s". MIST64. Archived from the original on 2020-08-28. Retrieved 2020-08-28 via github.com. (NB. Commented 6502 disassembly listings, merged from several versions of Microsoft BASIC for 6502 between 1977 and 1982 to recreate byte-exact copies of the original ROMs for 10 different machines from different vendors.)

Further reading