home *** CD-ROM | disk | FTP | other *** search
- From: genrad!decvax!decwrl!sun!dgh!dgh (David Hough)
- Subject: Announcement, README, Makefile for IEEE calculator
- Newsgroups: mod.sources
- Approved: jpn@panda.UUCP
-
- Mod.sources: Volume 3, Issue 3
- Submitted by: decvax!decwrl!sun!dgh!dgh (David Hough)
-
- #! /bin/sh
- : make a directory, cd to it, and run this through sh
- echo If this kit is complete, "End of Kit" will echo at the end
- echo Extracting announcement
- cat >announcement <<'End-Of-File'
- .de p
- .PP
- ..
- .de ts
- .ds CH \\$1
- .ds RH %
- .ds LH D. Hough
- .ds LF \\$3
- .ds CF
- .ds RF \\$2
- .TL
- \\$1
- .AU
- David Hough
- ..
- .ce
- Calculator for IEEE Floating Point Arithmetic
- .p
- Now that there is an approved IEEE standard for binary floating point
- arithmetic, persons interested in implementing the standard may be interested to
- learn of a software implementation of the standard available in the public domain.
- This implementation, called the IEEE calculator, provides a way to test
- your implementation in progress against a fairly complete implementation of the
- standard as it was specified in 1980.
- The IEEE calculator allows one to enter numbers in
- decimal or hex notation, perform any of the operations specified by the standard, and
- view the numerical results in decimal and hex as well as the exceptions signalled.
- .p
- The IEEE calculator is written entirely in Pascal and computes results a bit at
- a time. Consequently the arithmetic is too slow to use for any significant
- number of calculations but is ideal for debugging new implementations by providing
- a comparison for results and exceptions.
- .p
- As public domain software the IEEE calculator is completely unsupported;
- users bear the entire responsibility for determining its correctness for
- and applicability to any specific purpose. The program implements the standard
- as specified in 1980, but most subsequent changes in the standard are minor.
- .p
- Source code for
- the IEEE calculator will be published on USENET, the Unix network,
- in the newsgroup mod.sources, shortly after this announcement appears.
- End-Of-File
- echo Extracting ANNOUNCEMENT
- cat >ANNOUNCEMENT <<'End-Of-File'
-
-
-
-
-
-
- Calculator for IEEE Floating Point Arithmetic
-
- Now that there is an approved IEEE standard for binary
- floating point arithmetic, persons interested in implement-
- ing the standard may be interested to learn of a software
- implementation of the standard available in the public
- domain. This implementation, called the IEEE calculator,
- provides a way to test your implementation in progress
- against a fairly complete implementation of the standard as
- it was specified in 1980. The IEEE calculator allows one to
- enter numbers in decimal or hex notation, perform any of the
- operations specified by the standard, and view the numerical
- results in decimal and hex as well as the exceptions sig-
- nalled.
-
- The IEEE calculator is written entirely in Pascal and
- computes results a bit at a time. Consequently the arith-
- metic is too slow to use for any significant number of cal-
- culations but is ideal for debugging new implementations by
- providing a comparison for results and exceptions.
-
- As public domain software the IEEE calculator is com-
- pletely unsupported; users bear the entire responsibility
- for determining its correctness for and applicability to any
- specific purpose. The program implements the standard as
- specified in 1980, but most subsequent changes in the stan-
- dard are minor.
-
- Source code for the IEEE calculator will be published
- on USENET, the Unix network, in the newsgroup mod.sources,
- shortly after this announcement appears.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- September 2, 1985
-
-
- End-Of-File
- echo Extracting readme
- cat >readme <<'End-Of-File'
- .de p
- .PP
- ..
- .de ts
- .ds CH \\$1
- .ds RH %
- .ds LH D. Hough
- .ds LF \\$3
- .ds CF Company Confidential
- .ds RF \\$2
- .TL
- \\$1
- .AU
- David Hough
- ..
- .ce
- Test Calculator for IEEE Floating Point Arithmetic
- .p
- The IEEE Calculator is a program for testing an implementation of the
- IEEE Standard for Binary Floating-Point Arithmetic, drafted by IEEE
- Working Group P754, and adopted by the IEEE in 1985.
- It is primarily intended for the use of implementers in testing and
- checking their work.
- .p
- NOTICE:
- The IEEE Calculator was developed at Apple Computer in 1980 and modified
- only slightly since then, although the IEEE standard has changed
- somewhat since its 1980 draft. Apple Computer has donated the program to
- the public domain. Consequently any person may use the program as
- a public domain program, but in doing so takes the entire responsibility
- for determining its appropriateness and correctness for any particular
- use. Neither the author, nor Apple Computer, nor the IEEE support the
- program or warrant it to be applicable or correct for any
- particular purpose.
- .sp 2
- .ce
- Use
- .p
- COMMANDS:
- The IEEE calculator works like a reverse-Polish notation calculator.
- Operands are entered, then commands. A particular entry is first
- checked against the list of commands; if not a command, then it is
- tested as a possible decimal number; then as a possible hex number.
- .p
- Multiple commands and operands may be entered on one line, separated
- by semicolons:
- .nf
- Command: 2;sqrt;1;-
- .fi
- computes sqrt(2)-1 = .414...
- .p
- STACK:
- Operands are pushed on a stack, and popped as they are consumed
- by commands, which then push their results on the stack.
- In the example above, if the stack was empty at
- first, then it would contain only the result .414... at the end.
- .p
- When a new value is pushed on the stack, it is displayed in decimal
- and hex floating point format. If any IEEE exception flags were
- raised by the command that created the value, then they are displayed.
- Abbreviations used are IV, OV, UN, D0, NO, and NX, for integer overflow,
- floating point overflow, underflow, divide by zero, invalid operation,
- and inexact result.
- .p
- DATA TYPES:
- Stack entries are kept in an unrounded extended format. The unrounding
- means that the round and sticky bits are visible in the hex format.
- There are commands available to cause stack entries to be kept in
- single, double, or rounded extended precision.
- .p
- HEX FLOATING POINT:
- Stack entries are displayed in and may be entered in a hex floating
- point notation, consiting of hex digits followed by a decimal exponent.
- Thus
- .nf
- 1
- 1H
- .8h1
- 40h-6
- .fill
- are all ways of entering 1.0. Note that 100h100 means 256.0 * 2**100,
- NOT 256.0 * 2**256!
- .p
- TESTING:
- The command TEST places the calculator in a mode for performing
- each computation twice, once with its built in arithmetic and
- once with a user-defined arithmetic to be tested. For each
- computational command, results and exception flags are computed
- both ways and compared.
- .sp 2
- .ce
- Setting up the IEEE Calculator
- .p
- The Calculator is distributed on USENET as a series of SHAR files.
- When run, these create the necessary source files in a directory.
- One of these files is a Makefile which can be used to make three
- versions of the calculator.
- The calctest version does NOT test any user-defined arithmetic.
- Calc 32 and calc64 test single and double precision
- floating point arithmetic in the Pascal compiler pc contained in
- Release 2.0 of Sun Unix. These programs operate the same except when
- in TEST mode.
- .p
- Getting the calculator to work in other environments is primarily
- a matter of setting up the interface to the arithmetic to be tested.
- This is a system-dependent matter, so have fun.
- .p
- If it is desired to get the program operational for its own sake
- without any intent to test a local IEEE implementation, modify the
- Makefile to only create calctest.
- .sp 2
- .ce
- Commands
- .p
- Authoritative information on commands is to be gleaned, in the best
- Unix tradition, from detailed examination of the source code.
- .nf
- TEST toggle mode to test user-supplied arithmetic
- EXIT quit the program
-
- STOX80 change calculator storage mode to rounded extended
- STOF64 change calculator storage mode to IEEE double precision
- STOF32 change calculator storage mode to IEEE single precision
- STOI64 change calculator storage mode to 64 bit 2's complement integer
- STOI32 change calculator storage mode to 32 bit 2's complement integer
- STOI16 change calculator storage mode to 16 bit 2's complement integer
- UNROUNDED change calculator storage mode to unrounded extended (default)
- also change calculator rounding precision mode to 80 significant bits
- R24 change calculator rounding precision mode to 24 significant bits
- R53 change calculator rounding precision mode to 53 significant bits
- RN change calculator rounding mode to round to nearest (default)
- RM change calculator rounding mode to round toward minus infinity
- RP change calculator rounding mode to round toward plus infinity
- RZ change calculator rounding mode to round toward zero
- AFF change calculator infinity mode to affine (default)
- PROJ change calculator infinity mode to projective
- NORM change calculator subnormal mode to normalizing (default)
- WARN change calculator subnormal mode to warning
- IV OV UN D0 NO NX
- toggle the trap-enable for the corresponding exception
- default is disabled
-
- CLEAR clear stack
- CRUNCH clear stack except for top two entries
- DUP pop x, then push it twice
- DUMP print out contents of entire stack
- POP pop one operand
- REV pop x and y, push in reverse order
- E push an extended approximation to e
- PI push an extended approximation to pi
-
- ABS pop operand x, push abs(x)
- NEG pop x, push -x
- SQRT pop x, push sqrt(x)
- TOF32 pop x, convert to IEEE single precision, push
- TOF64 pop x, convert to IEEE double precision, push
- TOX80 pop x, convert to rounded extended precision, push
- TOF32I pop x, convert to IEEE single integral value, push
- TOF64I pop x, convert to IEEE double integral value, push
- TOX80I pop x, convert to extended integral value, push
- TOI16 pop x, convert to 16 bit 2's complement integer, push
- TOI32 pop x, convert to 32 bit 2's complement integer, push
- TOI64 pop x, convert to 64 bit 2's complement integer, push
-
- + pop two operands, add, push result
- - pop two operands, sub, push result
- * pop two operands, mul, push result
- / pop two operands, div, push result
- COMPARE pop x and y, push numerical result of comparison
- DIV pop x and y, push integral quotient
- REM pop x and y, push IEEE remainder from integral quotient
-
- LOGB an IEEE appendix function, logb
- NEXT an IEEE appendix function, nextafter
- SCALE an IEEE appendix function, scalb
- .fi
- End-Of-File
- echo Extracting README
- cat >README <<'End-Of-File'
-
-
-
-
-
-
- Test Calculator for IEEE Floating Point Arithmetic
-
- The IEEE Calculator is a program for testing an imple-
- mentation of the IEEE Standard for Binary Floating-Point
- Arithmetic, drafted by IEEE Working Group P754, and adopted
- by the IEEE in 1985. It is primarily intended for the use
- of implementers in testing and checking their work.
-
- NOTICE: The IEEE Calculator was developed at Apple Com-
- puter in 1980 and modified only slightly since then,
- although the IEEE standard has changed somewhat since its
- 1980 draft. Apple Computer has donated the program to the
- public domain. Consequently any person may use the program
- as a public domain program, but in doing so takes the entire
- responsibility for determining its appropriateness and
- correctness for any particular use. Neither the author, nor
- Apple Computer, nor the IEEE support the program or warrant
- it to be applicable or correct for any particular purpose.
-
-
- Use
-
- COMMANDS: The IEEE calculator works like a reverse-
- Polish notation calculator. Operands are entered, then com-
- mands. A particular entry is first checked against the list
- of commands; if not a command, then it is tested as a possi-
- ble decimal number; then as a possible hex number.
-
- Multiple commands and operands may be entered on one
- line, separated by semicolons:
- Command: 2;sqrt;1;-
- computes sqrt(2)-1 = .414...
-
- STACK: Operands are pushed on a stack, and popped as
- they are consumed by commands, which then push their results
- on the stack. In the example above, if the stack was empty
- at first, then it would contain only the result .414... at
- the end.
-
- When a new value is pushed on the stack, it is
- displayed in decimal and hex floating point format. If any
- IEEE exception flags were raised by the command that created
- the value, then they are displayed. Abbreviations used are
- IV, OV, UN, D0, NO, and NX, for integer overflow, floating
- point overflow, underflow, divide by zero, invalid opera-
- tion, and inexact result.
-
- DATA TYPES: Stack entries are kept in an unrounded
- extended format. The unrounding means that the round and
- sticky bits are visible in the hex format. There are com-
- mands available to cause stack entries to be kept in single,
- double, or rounded extended precision.
-
- HEX FLOATING POINT: Stack entries are displayed in and
-
-
-
- September 2, 1985
-
-
-
-
-
- - 2 -
-
-
- may be entered in a hex floating point notation, consiting
- of hex digits followed by a decimal exponent. Thus
- 1
- 1H
- .8h1
- 40h-6
- are all ways of entering 1.0. Note that 100h100 means 256.0
- * 2**100, NOT 256.0 * 2**256!
-
- TESTING: The command TEST places the calculator in a
- mode for performing each computation twice, once with its
- built in arithmetic and once with a user-defined arithmetic
- to be tested. For each computational command, results and
- exception flags are computed both ways and compared.
-
-
- Setting up the IEEE Calculator
-
- The Calculator is distributed on USENET as a series of
- SHAR files. When run, these create the necessary source
- files in a directory. One of these files is a Makefile
- which can be used to make three versions of the calculator.
- The calctest version does NOT test any user-defined arith-
- metic. Calc 32 and calc64 test single and double precision
- floating point arithmetic in the Pascal compiler pc con-
- tained in Release 2.0 of Sun Unix. These programs operate
- the same except when in TEST mode.
-
- Getting the calculator to work in other environments is
- primarily a matter of setting up the interface to the arith-
- metic to be tested. This is a system-dependent matter, so
- have fun.
-
- If it is desired to get the program operational for its
- own sake without any intent to test a local IEEE implementa-
- tion, modify the Makefile to only create calctest.
-
-
- Commands
-
- Authoritative information on commands is to be gleaned,
- in the best Unix tradition, from detailed examination of the
- source code.
- TEST toggle mode to test user-supplied arithmetic
- EXIT quit the program
-
- STOX80 change calculator storage mode to rounded extended
- STOF64 change calculator storage mode to IEEE double precision
- STOF32 change calculator storage mode to IEEE single precision
- STOI64 change calculator storage mode to 64 bit 2's complement integer
- STOI32 change calculator storage mode to 32 bit 2's complement integer
- STOI16 change calculator storage mode to 16 bit 2's complement integer
- UNROUNDED change calculator storage mode to unrounded extended (default)
- also change calculator rounding precision mode to 80 significant bits
-
-
-
- September 2, 1985
-
-
-
-
-
- - 3 -
-
-
- R24 change calculator rounding precision mode to 24 significant bits
- R53 change calculator rounding precision mode to 53 significant bits
- RN change calculator rounding mode to round to nearest (default)
- RM change calculator rounding mode to round toward minus infinity
- RP change calculator rounding mode to round toward plus infinity
- RZ change calculator rounding mode to round toward zero
- AFF change calculator infinity mode to affine (default)
- PROJ change calculator infinity mode to projective
- NORM change calculator subnormal mode to normalizing (default)
- WARN change calculator subnormal mode to warning
- IV OV UN D0 NO NX
- toggle the trap-enable for the corresponding exception
- default is disabled
-
- CLEAR clear stack
- CRUNCH clear stack except for top two entries
- DUP pop x, then push it twice
- DUMP print out contents of entire stack
- POP pop one operand
- REV pop x and y, push in reverse order
- E push an extended approximation to e
- PI push an extended approximation to pi
-
- ABS pop operand x, push abs(x)
- NEG pop x, push -x
- SQRT pop x, push sqrt(x)
- TOF32 pop x, convert to IEEE single precision, push
- TOF64 pop x, convert to IEEE double precision, push
- TOX80 pop x, convert to rounded extended precision, push
- TOF32I pop x, convert to IEEE single integral value, push
- TOF64I pop x, convert to IEEE double integral value, push
- TOX80I pop x, convert to extended integral value, push
- TOI16 pop x, convert to 16 bit 2's complement integer, push
- TOI32 pop x, convert to 32 bit 2's complement integer, push
- TOI64 pop x, convert to 64 bit 2's complement integer, push
-
- + pop two operands, add, push result
- - pop two operands, sub, push result
- * pop two operands, mul, push result
- / pop two operands, div, push result
- COMPARE pop x and y, push numerical result of comparison
- DIV pop x and y, push integral quotient
- REM pop x and y, push IEEE remainder from integral quotient
-
- LOGB an IEEE appendix function, logb
- NEXT an IEEE appendix function, nextafter
- SCALE an IEEE appendix function, scalb
-
-
-
-
-
-
-
-
-
-
- September 2, 1985
-
-
- End-Of-File
- echo Extracting Makefile
- cat >Makefile <<'End-Of-File'
- PASCAL = pc -c -L -w -g
- PASCALGO = pc -L -g
- OBJSTEST = calc.o calctest.o
- OBJS32 = calc.o calcf32.o
- OBJS64 = calc.o calcf64.o
-
- calc: calctest calc32 calc64
-
- calctest: $(OBJSTEST)
- $(PASCALGO) $(OBJSTEST) $(LIBS) -o calctest
-
- calc32: $(OBJS32)
- $(PASCALGO) $(OBJS32) $(LIBS) -o calc32
-
- calc64: $(OBJS64)
- $(PASCALGO) $(OBJS64) $(LIBS) -o calc64
-
- calctest.o: calctest.p calctest.h sane.h oldfplib.h
- $(PASCAL) calctest.p
-
- calcf32.o: calcf32.p calctest.h sane.h oldfplib.h calcsingle.h
- $(PASCAL) calcf32.p
-
- calcf64.o: calcf64.p calctest.h sane.h oldfplib.h calcdouble.h
- $(PASCAL) calcf64.p
-
- calc.o: calc.p dotest.i sane.h oldfplib.h calctest.h global.i forward.i init.i divrem.i extra.i storage.i addsubpas.i utility.i function.i hex.i base.i calcdouble.h calcsingle.h
- $(PASCAL) calc.p
- End-Of-File
- echo ""
- echo "End of Kit"
- exit
-
-