z-logo
Premium
A safe variant of the unsafe integer arithmetic of Java™
Author(s) -
Winkler Jürgen F. H.
Publication year - 2002
Publication title -
software: practice and experience
Language(s) - English
Resource type - Journals
SCImago Journal Rank - 0.437
H-Index - 70
eISSN - 1097-024X
pISSN - 0038-0644
DOI - 10.1002/spe.454
Subject(s) - arithmetic , computer science , programming language , java , integer (computer science) , arbitrary precision arithmetic , theoretical computer science , mathematics
Computers are finite machines and, therefore, the arithmetic operations in a programming language are different from their mathematical counterparts. These restrictions seem not to have been, in general, fully appreciated in programming languages and in computer science textbooks. One example is the programming language Java, which makes it difficult to warn the user in cases in which arithmetic operations produce incorrect results. In this paper we look at integer arithmetic in Java and develop a safe variant of the arithmetic operations in Java. The design of the safe variant of $+$ , $-_{\rm un}$ , $-_{\rm bin}$ , $*$ , $/$ and $**$ for the types byte , short , int and long reveals a number of deficiencies of Java in integer arithmetic, floating point arithmetic and program structure. Some of these deficiencies are also present in other contemporary programming languages. The paper therefore ends with some proposals for the design of the arithmetic elements of programming languages. Copyright © 2002 John Wiley & Sons, Ltd.

This content is not available in your region!

Continue researching here.

Having issues? You can contact us here