In
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, hardware and softw ...
, Microsoft Binary Format (MBF) is a format for
floating-point
In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a ''significand'' (a Sign (mathematics), signed sequence of a fixed number of digits in some Radix, base) multiplied by an integer power of that ba ...
numbers which was used in
Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
's
BASIC
Basic or BASIC may refer to:
Science and technology
* BASIC, a computer programming language
* Basic (chemistry), having the properties of a base
* Basic access authentication, in HTTP
Entertainment
* Basic (film), ''Basic'' (film), a 2003 film
...
languages, including
MBASIC
MBASIC is the Microsoft BASIC, Microsoft BASIC implementation of BASIC for the CP/M operating system. MBASIC is a descendant of the original Altair BASIC interpreters that were among Microsoft's first products. MBASIC was one of the two versions o ...
,
GW-BASIC
GW-BASIC is a dialect of the BASIC programming language developed by Microsoft from IBM BASICA. Functionally identical to BASICA, its BASIC interpreter is a fully self-contained executable and does not need the Cassette BASIC ROM found in the ori ...
and
QuickBASIC
Microsoft QuickBASIC (also QB) is an Integrated Development Environment (or IDE) and compiler for the BASIC programming language that was developed by Microsoft. QuickBASIC runs mainly on DOS, though there was also a short-lived version for the c ...
prior to version 4.00.
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
In mathematics, exponentiation, denoted , is an operation involving two numbers: the ''base'', , and the ''exponent'' or ''power'', . When is a positive integer, exponentiation corresponds to repeated multiplication of the base: that is, i ...
.
Extended (12k) BASIC included a double-precision type with 64 bits.
During the period when it was being ported from the
Intel 8080
The Intel 8080 is Intel's second 8-bit computing, 8-bit microprocessor. Introduced in April 1974, the 8080 was an enhanced successor to the earlier Intel 8008 microprocessor, although without binary compatibility.'' Electronic News'' was a week ...
platform to the
MOS 6502
The MOS Technology 6502 (typically pronounced "sixty-five-oh-two" or "six-five-oh-two") William Mensch and the moderator both pronounce the 6502 microprocessor as ''"sixty-five-oh-two"''. is an 8-bit microprocessor that was designed by a small ...
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 computer
Home computers were a class of microcomputers that entered the market in 1977 and became common during the 1980s. They were marketed to consumers as affordable and accessible computers that, for the first time, were intended for the use of a s ...
s of the 1970s and 1980s. These two versions are sometimes known as "6-digit" and "9-digit", respectively.
On
PCs with
x86
x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel, based on the 8086 microprocessor and its 8-bit-external-bus variant, the 8088. Th ...
processor,
QuickBASIC
Microsoft QuickBASIC (also QB) is an Integrated Development Environment (or IDE) and compiler for the BASIC programming language that was developed by Microsoft. QuickBASIC runs mainly on DOS, though there was also a short-lived version for the c ...
, 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
The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point arithmetic originally established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). The standard #Design rationale, add ...
format, introduced a few years earlier.
History
Bill Gates
William Henry Gates III (born October 28, 1955) is an American businessman and philanthropist. A pioneer of the microcomputer revolution of the 1970s and 1980s, he co-founded the software company Microsoft in 1975 with his childhood friend ...
and
Paul Allen
Paul Gardner Allen (January 21, 1953 – October 15, 2018) was an American businessman, computer programmer, and investor. He co-founded Microsoft, Microsoft Corporation with his childhood friend Bill Gates in 1975, which was followed by the ...
were working on
Altair BASIC
Altair BASIC is a discontinued interpreter for the BASIC programming language that ran on the MITS Altair 8800 and subsequent S-100 bus computers. It was Microsoft's first product (as Micro-Soft), distributed by MITS under a contract. Altair B ...
in 1975. They were developing the software at
Harvard University
Harvard University is a Private university, private Ivy League research university in Cambridge, Massachusetts, United States. Founded in 1636 and named for its first benefactor, the History of the Puritans in North America, Puritan clergyma ...
on a
DEC PDP-10
Digital Equipment Corporation (DEC)'s PDP-10, later marketed as the DECsystem-10, is a mainframe computer family manufactured beginning in 1966 and discontinued in 1983. 1970s models and beyond were marketed under the DECsystem-10 name, especi ...
running their
Altair
Altair is the brightest star in the constellation of Aquila (constellation), Aquila and the list of brightest stars, twelfth-brightest star in the night sky. It has the Bayer designation Alpha Aquilae, which is Latinisation of name ...
emulator
In computing, an emulator is Computer hardware, hardware or software that enables one computer system (called the ''host'') to behave like another computer system (called the ''guest''). An emulator typically enables the host system to run sof ...
.
One thing they lacked was code to handle floating-point numbers, required to support calculations with very big and very small numbers,
which would be particularly useful for science and engineering.
One of the proposed uses of the Altair was as a scientific calculator.
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
and one of them,
Monte Davidoff
Monte Davidoff (; born 1956) is an American computer programmer.
Davidoff is from Glendale, Wisconsin. He graduated from Nicolet High School in 1974, and went on to Harvard College, where he majored in applied mathematics, the department at Harv ...
, 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.
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.
When Allen had to demonstrate it to
MITS
MITS may stand for:
*Madhav Institute of Technology and Science (MITS Gwalior), a college in Madhya Pradesh, India
*Micro Instrumentation and Telemetry Systems, an American electronics company known for the Altair 8800
*Mody Institute of Technolog ...
, it was the first time it ran on an actual Altair.
But it worked, and when he entered ‘PRINT 2+2’, Davidoff's adding routine gave the correct answer.
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.
A comment in the source credits Davidoff as the writer of Altair BASIC's math package.

Altair BASIC took off, and soon most early home computers ran some form of Microsoft BASIC.
The BASIC port for the
6502
The MOS Technology 6502 (typically pronounced "sixty-five-oh-two" or "six-five-oh-two") William Mensch and the moderator both pronounce the 6502 microprocessor as ''"sixty-five-oh-two"''. is an 8-bit microprocessor that was designed by a small ...
CPU, such as used in the
Commodore PET
The Commodore PET is a line of personal computers produced starting in 1977 by Commodore International. A single all-in-one case combines a MOS Technology 6502 microprocessor, Commodore BASIC in read-only memory, keyboard, monochrome monitor ...
, 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.
This extended format was not only provided by
Commodore BASIC
Commodore BASIC, also known as PET BASIC or CBM-BASIC, is the Dialect (computing), dialect of the BASIC programming language used in Commodore International's 8-bit home computer line, stretching from the Commodore PET, PET (1977) to the Commodore ...
1 & 2, but was also supported by
Applesoft BASIC
Applesoft BASIC is a dialect of Microsoft BASIC, developed by Marc McDonald and Ric Weiland, supplied with Apple II computers. It supersedes Integer BASIC and is the BASIC in Read-only memory, ROM in all Apple II series computers after the ori ...
I & II since version 1.1 (1977),
KIM-1
The KIM-1, short for ''Keyboard Input Monitor'', is a small MOS Technology 6502, 6502-based single-board computer developed and produced by MOS Technology, MOS Technology, Inc. and launched in 1976. It was very successful in that period, due to ...
BASIC since version 1.1a (1977), and
MicroTAN BASIC since version 2b (1980).
Not long afterwards, the
Z80
The Zilog Z80 is an 8-bit microprocessor designed by Zilog that played an important role in the evolution of early personal computing. Launched in 1976, it was designed to be software-compatible with the Intel 8080, offering a compelling altern ...
ports, such as
Level II BASIC
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 ve ...
for the
TRS-80
The TRS-80 Micro Computer System (TRS-80, later renamed the Model I to distinguish it from successors) is a desktop microcomputer developed by American company Tandy Corporation and sold through their Radio Shack stores. Launched in 1977, it is ...
(1978), introduced the 64-bit, double-precision format as a separate data type from 32-bit, single-precision.
Microsoft used the same floating-point formats in their implementation of
Fortran and for their macro assembler
MASM,
although their spreadsheet
Multiplan and their
COBOL
COBOL (; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed for business use. It is an imperative, procedural, and, since 2002, object-oriented language. COBOL is primarily ...
implementation used
binary-coded decimal
In computing and electronic systems, binary-coded decimal (BCD) is a class of binary encodings of decimal numbers where each digit is represented by a fixed number of bits, usually four or eight. Sometimes, special bit patterns are used f ...
(BCD) floating point.
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.
In a parallel development,
Intel
Intel Corporation is an American multinational corporation and technology company headquartered in Santa Clara, California, and Delaware General Corporation Law, incorporated in Delaware. Intel designs, manufactures, and sells computer compo ...
had started the development of a floating-point
coprocessor
A coprocessor is a computer processor used to supplement the functions of the primary processor (the CPU). Operations performed by the coprocessor may be floating-point arithmetic, graphics, signal processing, string processing, cryptography or ...
in 1976.
William Morton Kahan, as a consultant to Intel, suggested that Intel use the floating point of
Digital Equipment Corporation
Digital Equipment Corporation (DEC ), using the trademark Digital, was a major American company in the computer industry from the 1960s to the 1990s. The company was co-founded by Ken Olsen and Harlan Anderson in 1957. Olsen was president until ...
's (DEC) VAX. The first VAX, the
VAX-11/780
The VAX-11 is a discontinued family of 32-bit superminicomputers, running the Virtual Address eXtension (VAX) instruction set architecture (ISA), developed and manufactured by Digital Equipment Corporation (DEC). Development began in 1976. In ad ...
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.
However, seeking to market their chip to the broadest possible market, Kahan was asked to draw up specifications.
When rumours of Intel's new chip reached its competitors, they started a standardization effort, called
IEEE 754
The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point arithmetic originally established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). The standard #Design rationale, add ...
, 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,
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
The CDC 6600 was the flagship of the 6000 series of mainframe computer systems manufactured by Control Data Corporation. Generally considered to be the first successful supercomputer, it outperformed the industry's prior recordholder, the I ...
from 1965.
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 number
In computer science, subnormal numbers are the subset of denormalized numbers (sometimes called denormals) that fill the underflow gap around zero in floating-point arithmetic. Any non-zero number with magnitude smaller than the smallest positive ...
s, which help mitigate problems caused by underflow;
and a better balanced
exponent bias, which could help avoid overflow and underflow when taking the reciprocal of a number.
By the time
QuickBASIC 4.00 was released, the IEEE 754 standard had become widely adopted—for example, it was incorporated into Intel's
387
__NOTOC__
Year 387 (Roman numerals, CCCLXXXVII) was a common year starting on Friday of the Julian calendar. At the time, it was known in Rome as the Year of the Consulship of Valentinian II, Augustus and Eutropius (historian), Eutropius (or, l ...
coprocessor and every
x86
x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel, based on the 8086 microprocessor and its 8-bit-external-bus variant, the 8088. Th ...
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 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 Visual Basic is a name for a family of programming languages from Microsoft. It may refer to:
* Visual Basic (.NET), the current version of Visual Basic launched in 2002 which runs on .NET
* Visual Basic (classic), the original Visual Basic suppo ...
also uses the IEEE 754 format instead of MBF.
Technical details
MBF numbers consist of an 8-bit base-2
exponent
In mathematics, exponentiation, denoted , is an operation involving two numbers: the ''base'', , and the ''exponent'' or ''power'', . When is a positive integer, exponentiation corresponds to repeated multiplication of the base: that is, i ...
, a sign
bit
The bit is the most basic unit of information in computing and digital communication. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represented as ...
(positive mantissa: ''s'' = 0; negative mantissa: ''s'' = 1) and a 23-,
31-
or 55-bit
mantissa of the
significand
The significand (also coefficient, sometimes argument, or more ambiguously mantissa, fraction, or characteristic) is the first (left) part of a number in scientific notation or related concepts in floating-point representation, consisting of its s ...
. There is always a 1-bit implied to the left of the explicit mantissa, and the
radix point
alt=Four types of separating decimals: a) 1,234.56. b) 1.234,56. c) 1'234,56. d) ١٬٢٣٤٫٥٦., Both a full_stop.html" ;"title="comma and a full stop">comma and a full stop (or period) are generally accepted decimal separators for interna ...
is located before this
assumed bit. The exponent is encoded with a
bias
Bias is a disproportionate weight ''in favor of'' or ''against'' an idea or thing, usually in a way that is inaccurate, closed-minded, prejudicial, or unfair. Biases can be innate or learned. People may develop biases for or against an individ ...
of , so that exponents are represented by ''x'' = , exponents are represented by ''x'' = , 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
The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point arithmetic originally established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). The standard #Design rationale, add ...
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.
Unlike IEEE floating point, MBF doesn't support
denormal number
In computer science, subnormal numbers are the subset of denormalized numbers (sometimes called denormals) that fill the underflow gap around zero in floating-point arithmetic. Any non-zero number with magnitude smaller than the smallest positive ...
s,
infinities or
NaNs.
MBF single-precision format (32 bits, "6-digit BASIC"):
MBF extended-precision format (40 bits, "9-digit BASIC"):
MBF double-precision format (64 bits):
Examples
See also
*
Floating-point arithmetic
In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a ''significand'' (a Sign (mathematics), signed sequence of a fixed number of digits in some Radix, base) multiplied by an integer power of that ba ...
*
IEEE 754
The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point arithmetic originally established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). The standard #Design rationale, add ...
— Standard for floating-point arithmetic
*
IBM hexadecimal floating-point
Hexadecimal floating-point arithmetic, floating point (now called HFP by IBM) is a format for encoding floating-point numbers first introduced on the IBM IBM System/360, System/360 computers, and supported on subsequent machines based on that arch ...
References
Further reading
*
* {{cite web , title=The Math Package , date=2014 , orig-date=1975 , editor-first=Reuben , editor-last=Harris , work=altairbasic.org , url=http://altairbasic.org/math_ex.htm , access-date=2024-03-29 , url-status=live , archive-url=https://web.archive.org/web/20240329151742/http://altairbasic.org/math_ex.htm , archive-date=2024-03-29
External links
* Microsof
providesa dynamic link library for 16-bit Visual Basic containing functions to convert between MBF data and IEEE 754.
** This library wraps the MBF conversion functions in the 16-bit Visual C(++) CRT.
** These conversion functions will round an IEEE double-precision number like ¾ ⋅ 2
−128 to zero rather than to 2
−128.
** They don't support
denormals at all: the IEEE or MBF single-precision number 2
−128 will be converted to zero, even though it is representable in either format.
** This library is only intended for use with Visual Basic; C(++) programs are expected to call the CRT functions directly.
* https://github.com/option8/Altair-BASIC
Binary arithmetic
Computer arithmetic
Floating point