The Euclidean Definition of the Functions div, and mod

😉 Good Guy 😉 <[email protected]>
Newsgroups gmane.test
Message-ID <[email protected]>
The definitions of the functions div and mod in the computer science 
literature and in programming languages are either similar to the Algol 
or 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 O <= 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.


-- 
With over 1.2 billion devices now running Windows 10, customer 
satisfaction is higher than any previous version of windows.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.