词条 | Microsoft Binary Format | |||||||||||||||||||||||||||
释义 |
In computing, Microsoft Binary Format (MBF) was a format for floating-point numbers used in Microsoft's BASIC language products, including MBASIC, GW-BASIC and QuickBasic prior to version 4.00.[1][2][3][4][5][6][7] HistoryIn 1975, Bill Gates and Paul Allen were working on Altair BASIC, which they were developing at Harvard University on a PDP-10 running their Altair emulator.[8] One thing still missing was code to handle floating-point numbers, needed to support calculations with very big and very small numbers,[8] which would be particularly useful for science and engineering.[9][10] One of the proposed uses of the Altair was as a scientific calculator.[11] At a dinner at Currier House, an undergraduate residential house at Harvard, Gates and Allen complained to their dinner companions about having to write this code.[8] 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.[8] At the time 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.[12] When Allen had to demonstrate it to MITS, it was the first time it ran on an actual Altair.[13] But it worked, and when he entered ‘PRINT 2+2’, Davidoff's adding routine gave the correct answer.[8] The source code for Altair BASIC was thought to have been lost to history, but resurfaced in 2000. It had been sitting behind Gates's former tutor and dean Harry Lewis's file cabinet, who rediscovered it.[14][15] A comment in the source credits Davidoff as the writer of Altair BASIC's math package.[14][15] Altair BASIC took off, and soon most early home computers ran some form of Microsoft BASIC.[16][17] 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.[18] 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).[18] 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] IEEE 754{{Main|IEEE 754}}As early as in 1976, Intel was starting the development of a floating-point coprocessor.[33][34] Intel hoped to be able to sell a chip containing good implementations of all the operations found in the widely varying maths software libraries.[33][35] John Palmer, who managed the project, contacted William Kahan, who 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. However, seeking to market their chip to the broadest possible market, Intel wanted the best floating point possible, and Kahan went on to draw up specifications. 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. Kahan got Palmer's permission to participate; he was allowed to explain Intel's design decisions and their underlying reasoning, but not anything related to Intel's implementation architecture.[33][34][35][36] VAX's floating-point formats differed from MBF only in that it had the sign in the most significant bit.[37][38] It turned out that for double-precision numbers, an 8-bit exponent isn't wide enough for some wanted operations, e.g. to store the product of two 32-bit numbers.[1] Both Kahan's proposal and a counter-proposal by DEC therefore used 11 bits, like the time-tested 60-bit floating-point format of the CDC 6600 from 1965.[34][36][39] 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;[36][40][41] and a better balanced exponent bias, which can help avoid overflow and underflow when taking the reciprocal of a number.[42][43] In 1980 the Intel 8087 chip was already released,[44] but DEC remained opposed, to denormal numbers in particular, because of performance concerns and since it would give DEC a competitive advantage to standardise on DEC's format. The next year DEC had a study done in order to demonstrate that gradual underflow was a bad idea, but the study concluded the opposite, and DEC gave in. In 1985 the standard was ratified, but it had already become the de facto standard a year earlier, implemented by many manufacturers.[34][36][45] 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 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. {{anchor|32-bit MBF|40-bit MBF|64-bit MBF}}Technical detailsMBF numbers consist of an 8-bit base-2 exponent with a bias of 128, so that exponents −127…−1 are represented by x = 1…127 (01h…7Fh), exponents 0…127 are represented by x = 128…255 (80h…FFh), with a special case for x = 0 (00h) representing the whole number being zero, a sign bit (positive mantissa: s = 0; negative mantissa: s = 1) and a 23-,[18] 31-[18] or 55-bit 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 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][46][47] Unlike IEEE floating point, MBF doesn't support denormal numbers, infinities or NaNs.[48] 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
32-bit format: 84h, 20h, 00h, 00h 40-bit format: 84h, 20h, 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{{Portal|Computer Science}}
References1. ^1 2 {{cite web |title=IEEE vs. Microsoft Binary Format; Rounding Issues (Complete) |publisher=Microsoft Support |date=2006-11-21 |url=http://support.microsoft.com/kb/35826 |access-date=2010-02-24}} 2. ^{{cite web |url=https://support.microsoft.com/en-us/kb/42980 |title=(Complete) Tutorial to Understand IEEE Floating-Point Errors |website=support.microsoft.com |access-date=2016-06-02}} 3. ^1 {{cite web |url=https://stackoverflow.com/questions/2686298/convert-pre-ieee-754-c-floating-point-numbers-to-from-c-sharp |quote=Read with care. 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. |title=Article: Floating Point Numbers |website=stackoverflow.com |access-date=2016-06-02}} 4. ^{{cite web |title=The MASM 6.1 documentation notes that 5.1 was the last MASM version to support MBF |url=http://people.sju.edu/~ggrevera/arch/references/MASM61PROGUIDE.pdf |website=people.sju.edu |access-date=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 (This is the BASICA manual.) 7. ^{{cite web |url=http://www.trs-80.com/trs80-zaps-internals.htm#rommath |title=ROM Routes (Integer Math) |website=Trs-80.com |access-date=2016-06-02}} 8. ^1 2 3 4 {{cite web |author-last=Ireland |author-first=Corydon |url=http://news.harvard.edu/gazette/story/2013/09/dawn-of-a-revolution |title=Dawn of a revolution | Harvard Gazette |publisher=news.harvard.edu |access-date=2016-05-30}} 9. ^{{cite journal |url=http://www.sciencedirect.com/science/article/pii/0898122187901817 |doi=10.1016/0898-1221(87)90181-7 |volume=14 |title=An introduction to the scientific computing language Pascal-SC |journal=Computers |pages=53–69 |date=1987 |author-last=Rall |author-first=L. B.}} 10. ^{{cite web |url=http://cis.poly.edu/~mleung/CS3734/s05/ch01/floatingPoints2.pdf |title=Floating-Point Numbers in Digital Computers |author-first=K. Ming |author-last=Leung |website=cis.poly.edu |access-date=2016-06-02}} 11. ^{{cite book |url=https://books.google.com/books?id=klV_BAAAQBAJ&pg=PA16 |title=Bill Gates: A Biography |date=2014-08-26 |access-date=2016-05-30 |isbn=978-1-44083014-3 |author-last=Becraft |author-first=Michael B.}} 12. ^{{cite web |url=http://altairbasic.org/math_ex.htm |title=Altair BASIC 3.2 (4K Edition) |publisher=altairbasic.org |access-date=2016-05-30}} 13. ^{{cite web |url=https://www.theregister.co.uk/2001/05/11/microsoft_altair_basic_legend_talks/ |title=Microsoft Altair BASIC legend talks about Linux, CPRM and that very frightening photo |website=theregister.co.uk |access-date=2016-05-30}} 14. ^1 {{cite web |url=https://www.theregister.co.uk/2001/05/13/raiders_of_the_lost_altair/ |title=Raiders of the Lost Altair BASIC Source Code |website=theregister.co.uk |access-date=2016-05-30}} 15. ^1 {{cite web |url=http://www.rjh.org.uk/altair/ian.htm |title=Quest for the Holy Source - Ian's trip to Harvard |access-date=2016-05-30 |dead-url=unfit |archive-url=https://web.archive.org/web/20020102173701/http://www.rjh.org.uk/altair/ian.htm |archive-date=2002-01-02}} 16. ^{{cite web |url=http://www.oldcomputers.net/important-computer-people.html |title=Important computer inventors |publisher=Oldcomputers.net |access-date=2016-05-30}} 17. ^{{cite web |url=http://comp.lang.basic.powerbasic.narkive.com/erBpXdwr/basic-7-0-for-windows#post4 |title=Basic 7.0 for Windows |publisher=comp.lang.basic.powerbasic.narkive.com |access-date=2016-05-30}} 18. ^1 2 3 4 5 6 7 8 9 10 11 12 13 14 {{cite web |title=Create your own Version of Microsoft BASIC for 6502 |author-first=Michael |author-last=Steil |publisher=pagetable.com |date=2008-10-20 |url=http://www.pagetable.com/?p=46 |access-date=2016-05-30 |dead-url=no |archive-url=https://web.archive.org/web/20160530092603/http://www.pagetable.com/?p=46 |archive-date=2016-05-30}} 19. ^{{cite web |url=https://archive.org/details/Level_II_BASIC_Reference_Manual_1st_Ed._1978_Radio_Shack |title=Radio Shack Hardware Manual: Level II BASIC Reference Manual 1st Ed. (1978)(Radio Shack): Free Download & Streaming: Internet Archive |access-date=2016-05-30}} 20. ^{{cite web |url=http://akhara.com/trs-80/docs/model1/Level%20II%20BASIC%20Reference%20Manual%20(1979)(Radio%20Shack)(pdf).zip |format=PDF |title=Level II Basic |website=akhara.com |access-date=2016-06-02}} 21. ^{{cite web |url=https://archive.org/details/BASIC-80_MBASIC_Reference_Manual |title=BASIC-80 (MBASIC) Reference Manual |format=PDF |access-date=2016-05-30}} 22. ^{{cite web |url=http://www.textfiles.com/bitsavers/pdf/microsoft/cpm/Microsoft_FORTRAN-80_Ver3.4_Users_Manual_Nov80.pdf |title=(page 45 and 55) |website=textfiles.com |access-date=2016-05-30}} 23. ^{{cite web |url=ftp://ftp.gwdg.de/pub/mpsf/pc_doc/dosbesch.ps |title=Archived copy |access-date=2015-10-07 |dead-url=yes |archive-url=https://web.archive.org/web/20050220040002/http://ftp.gwdg.de/pub/mpsf/pc_doc/dosbesch.ps |archive-date=2005-02-20}} 24. ^{{cite web |url=http://www.classiccmp.org/dunfield/kyocera/t200mpln.pdf |title=Tandy 200 Multiplan Manual |website=classiccmp.org |access-date=2016-06-02}} 25. ^Microsoft C Pcode Specifications, page 13; 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. ^{{cite web |url=http://www.textfiles.com/bitsavers/pdf/microsoft/cpm/Microsoft_COBOL-80_1978.pdf |title=(page 26 = 32 in the PDF) |website=textfiles.com |access-date=2016-05-30}} 27. ^{{cite web |url=http://www.textfiles.com/programming/qwk.txt |format=TXT |title=QWK Mail Packet File Layout |author-first=Patrick Y. |author-last=Lee |website=textfiles.com |access-date=2016-06-02}} 28. ^{{cite web |url=http://www.csidata.com/patch/csim.txt |format=TXT |title=This document describes the abandoned CompuTrac data format, which until recently was actively used by Equis' MetaStock charting software |website=csidata.com |access-date=2016-06-02 |dead-url=yes |archive-url=https://web.archive.org/web/20160305170347/http://www.csidata.com/patch/csim.txt |archive-date=2016-03-05}} 29. ^{{cite web |url=https://www.7api.com/converting-microsoft-binary-format-to-ieee-format-using-vb-6-beatfx.html |title=Converting Microsoft Binary Format to IEEE format Using VB 6 |publisher=7api.com |date=2016-05-04 |access-date=2016-05-30}}{{dead link|date=January 2018 |bot=InternetArchiveBot |fix-attempted=yes}} 30. ^{{cite web |url=http://www.tek-tips.com/viewthread.cfm?qid=592713 |title=Help !Anybody know how to convert old M/S MBF value from Qbasic to VB6 - Visual Basic(Microsoft): Version 5 & 6 |publisher=Tek-Tips |access-date=2016-05-30}} 31. ^{{cite web |author=GL88 |url=https://social.msdn.microsoft.com/Forums/vstudio/en-US/64a201b5-852d-41df-9abe-2ad2645cc937/reading-binary-format-qbasic-with-c?forum=netfxbcl |title=Reading Binary Format (QBasic) with C# |publisher=Social.msdn.microsoft.com |access-date=2016-05-30}} 32. ^{{cite web |url=http://r.789695.n4.nabble.com/Reading-MetaStock-data-format-in-R-td4677240.html |title=Rmetrics - Reading MetaStock data format in R |publisher=R.789695.n4.nabble.com |date=2013-09-30 |access-date=2016-05-30}} 33. ^1 2 {{cite web |url=http://www.intel.com/content/dam/www/public/us/en/documents/case-studies/floating-point-case-study.pdf |title=Archived copy |access-date=2016-05-30 |dead-url=yes |archive-url=https://web.archive.org/web/20160304114859/http://www.intel.com/content/dam/www/public/us/en/documents/case-studies/floating-point-case-study.pdf |archive-date=2016-03-04}} 34. ^1 2 3 {{cite web |url=https://www.cs.berkeley.edu/~wkahan/ieee754status/754story.html |title=An Interview with the Old Man of Floating-Point |publisher=cs.berkeley.edu |date=1998-02-20 |access-date=2016-05-30}} 35. ^1 {{cite web |author-last=Woehr |author-first=Jack |url=http://www.drdobbs.com/architecture-and-design/a-conversation-with-william-kahan/184410314 |title=A Conversation with William Kahan | Dr. Dobb's |publisher=drdobbs.com |date=1997-11-01 |access-date=2016-05-30}} 36. ^1 2 3 {{cite web |url=http://www.dr-chuck.com/dr-chuck/papers/columns/r3114.pdf |title=IEEE 754: An Interview with William Kahan |website=dr-chuck.com |access-date=2016-06-02}} 37. ^{{cite web |url=http://nssdc.gsfc.nasa.gov/nssdc/formats/VAXFloatingPoint.htm |title=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. |website=nssdc.gsfc.nasa.gov |access-date=2016-06-02}} 38. ^{{cite web |url=http://www.ece.cmu.edu/~ece447/s15/lib/exe/fetch.php?media=vax_hwhbk_1979.pdf |title=VAX11 780 |website=Ece.cmu.edu |access-date=2016-06-02}} 39. ^{{cite web |url=http://ygdes.com/CDC/DesignOfAComputer_CDC6600.pdf |title=Design of a Computer: The Control Data 6600 |author-first=J. E. |author-last=Thornton |website=ygdes.com |access-date=2016-06-02}} 40. ^{{cite web |url=https://www.cs.berkeley.edu/~wkahan/ieee754status/why-ieee.pdf |title=Why do we need a floating-point arithmetic standard? |author-first=William Morton |author-last=Kahan |website=cs.berkeley.edu |access-date=2016-06-02}} 41. ^{{cite web |url=https://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf |title=How Java's Floating-Point Hurts Everyone Everywhere |author-first1=William Morton |author-last1=Kahan |author-first2=Joseph D. |author-last2=Darcy |website=cs.berkeley.edu |access-date=2016-06-02}} 42. ^{{cite book |url=https://books.google.com/books?id=sUD8CAAAQBAJ&pg=PA171 |title=Numerical Analysis and Parallel Processing: Lectures given at The Lancaster ... |date=2013-12-21 |access-date=2016-05-30 |isbn=978-3-66239812-8 |author-last=Turner |author-first=Peter R.}} 43. ^{{cite web |url=https://www.cs.berkeley.edu/~wkahan/ieee754status/Names.pdf |title=Names for Standardized Floating-Point Formats |website=cs.berkeley.edu |access-date=2016-06-02}} 44. ^{{cite web |url=http://micro.magnet.fsu.edu/optics/olympusmicd/galleries/chips/intel8087.html |title=Molecular Expressions: Science, Optics & You - Olympus MIC-D: Integrated Circuit Gallery - Intel 8087 Math Coprocessor |publisher=micro.magnet.fsu.edu |access-date=2016-05-30}} 45. ^{{cite web |url=https://www.cs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF |title=IEEE Standard 754 for Binary Floating-Point Arithmetic |author-first=William Morton |author-last=Kahan |website=cs.berkeley.edu |access-date=2016-06-02}} 46. ^{{cite web |title=Converting between Microsoft Binary and IEEE formats |date=1998-07-02 |orig-year=1994-03-10 |id=1400 |author=Borland staff |publisher=Embarcadero USA (originally: Borland) |work=Technical Information Database |type=TI1431C.txt |url=https://community.embarcadero.com/index.php/article/technical-articles/162-programming/14799-converting-between-microsoft-binary-and-ieee-forma |access-date=2016-05-30 |dead-url=no |archive-url=https://web.archive.org/web/20190220230417/https://community.embarcadero.com/index.php/article/technical-articles/162-programming/14799-converting-between-microsoft-binary-and-ieee-forma |archive-date=2019-02-20}} 47. ^{{cite web |url=https://groups.google.com/forum/#!topic/comp.os.msdos.programmer/mDyRI1wolAc |title=Google Groups |website=Groups.google.com |access-date=2016-06-02}} 48. ^{{cite web |url=http://www.boyet.com/Articles/MBFSinglePrecision.html |title=julian m bucknall >> Understanding single precision MBF |publisher=boyet.com |access-date=2016-05-30}} External links
3 : Binary arithmetic|Computer arithmetic|Floating point |
|||||||||||||||||||||||||||
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。