Abstract
The definitions of the functions div and mod in the computer science literature and in programming languages are either similar to the Algol of Pascal definition (which is shown to be an unfortunate choice) or based on division by truncation (T-definition) or division by flooring as defined by Knuth (F-definition). The differences between various definitions that are in common usage are discussed, and an additional one is proposed, which is based on Euclid's theorem and therefore is called the Euclidean definition (E-definition). Its distinguishing feature is that 0 ≤ D mod d < | d | irrespective of the signs of D and d. It is argued that the E- and F-definitions are superior to all other ones in regularity and useful mathematical properties and hence deserve serious consideration as the standard convention at the applications and language level. It is also shown that these definitions are the most suitable ones for describing number representation systems and the realization of arithmetic operations at the architecture and hardware level.
- 1 American National Standards Institute. ANSI/MIL-Std 1815 A, Reference Manual for the Ada Programming Language. Alsys, France, Jan. 1983.Google Scholar
- 2 BOUTE, R. Formal description of digital systems. In Methodolog~es for Computer $ystem Design. W. K. Giloi and B. D. Shriver, Eds., North-Holland, Amsterdam, 1985, pp. 291-306.Google Scholar
- 3 BOUTE, R. Funmath: Towards a general formalism for system description in engineering applications. In Advances in Electr~cal Engineering Software, P. P. Silvester, Ed., Sprmger~ Verlag, New York, 1990, pp. 215-226.Google Scholar
- 4 BOUTE, R. On the equivalence of rime-division and frequency-division multiplexing. IEEE Trans. Commun. COM-33, i (Jan. 1985), 97-99.Google Scholar
- 5 BOUTE, R. Representational and denotational semantics of digital systems. IEEE Trans. Comput. 38, 7 (July 1989), 986-999. Google Scholar
- 6 BOU~E, R. Syntactic and semantic aspects of formal system description. M~croprocess~ng and Microprogramming 27 (1989), 155-162.Google Scholar
- 7 CODY, W. J., ET AL. A proposed radix- and word-length-independent standard for fioatingpoint arithmetic. IEEE Micro 4, 4 (Aug. 1984), 86-100.Google Scholar
- 8 COHEN, D. On holy wars and a plea for peace. IEEE Comput. 14, 10 (Oct. 1981), 48-54.Google Scholar
- 9 HERSTEIN, I.N. Top~cs in Algebra. Xerox College Publ., Lexington, Mass., 1964.Google Scholar
- 10 HmFINGER, P.N. Silage Reference Manual, Rev. 1.3. University of California, Berkeley, Dec. 1987.Google Scholar
- 11 ISO/IEC 7185, Information Technology--Programming Languages--PascaL International Standard, 2nd ed., ISO/IEC 7185, 1990 (E).Google Scholar
- 12 JAMES, D. V. Multiplexed buses: The endian wars continue," IEEE Micro 10, 3 (June 1990), 9-21. Google Scholar
- 13 JENSEN, K., AND WmTH, N. Pascal User Manual and Report. 3rd ed., Sprmger-Verlag, New York, 1985. Google Scholar
- 14 KNUTH, D.E. The Art of Computer Programming, Vol. 1: Fundamental Algor~thms. 2nd ed. Addison-Wesley, Reading, Mass., 1972. Google Scholar
- 15 McDoNNELL, E. E Complex fioor. In APL Congress 73, P. Gjerl~v et al., Eds., North-Holland, Amsterdam, 1973, pp. 299-305.Google Scholar
- 16 McDoN~ELL, E. E. Fuzzy residue. In Proceedings of the APL'79 Conference. Rochester, N.Y., June 1979, pp 42-46. Google Scholar
- 17 STEELE, G. L., JR., Arithmetic shifting considered harmful. SIGPLAN Not. 12, 11 (Nov. 1977), 61-68. Google Scholar
- 18 STEELE, G. L., JR., Common LISP: The Language. Digital Press, Billerica, Mass., 1984. Google Scholar
- 19 TURNER, D. Miranda System Manual, Version 1.009. Research Software Ltd., Canterbury, Kent, May 1987.Google Scholar
- 20 VAN WIJNG^ARDEN, A., ET AL. Revised Report on the Algorithmic Language Algol 68. Springer~Verlag, New York, 1976.Google Scholar
Index Terms
- The Euclidean definition of the functions div and mod
Recommendations
Energy and fan-in of threshold circuits computing mod functions
TAMC'11: Proceedings of the 8th annual conference on Theory and applications of models of computationIn this paper, we consider a threshold circuit C computing the modulus function MODm, and investigate a relationship between two complexity measures, fan-in l and energy e of C, where the fan-in l is defined to be the maximum number of inputs of every ...
Structure specification with a procedural hardware description language
This correspondence describes the extension and formalization of the hardware description language AHPL to form AHPL III. This language provides for nesting AHPL descriptions within descriptions. It incorporates a general index extension mechanism which ...
New Sequences with Low Correlation and Large Family Size
In direct-sequence code-division multiple-access (DS-CDMA) communication systems and direct-sequence ultra wideband (DS-UWB) radios, sequences with low correlation and large family size are important for reducing multiple access interference (MAI) and ...
Comments