LONG ARITHMETIC IN EXCEL. I. VBA-IMPLEMENTATION

Vitaly Fourman, M. Khomyak, Ya. Marko

Abstract


Approaches that increase the accuracy of computations occupy a special place in computational methods. The use of integer arithmetic of arbitrary precision requires а software implementation of operations based on 32- or 64-bit types supported by modern processors. The software and Internet resources for full precision computations representing the commercial sector and free-code programs are analyzed.

We propose to use wide-popular Excel spreadsheets as a convenient and sufficiently powerful symbolic calculator as an alternative to well-known powerful but high-priced packages. The basic operations are implemented in VBA: comparison, arithmetic actions and finding of the greatest common divisor for two integers with arbitrary digits saved in cells as text. At internal level an integer is represented by a BCD-array of digits with  variable dimension, and its sign is stored separately. So we have two levels of implementation: through text strings and their internal representation. Operations "add", "subtract", "multiply" correspond to schoolbook algorithms but "divide" is more complex. The algorithm of short dividing for decimal numbers is justified which do not require the subtraction loop to correction the result digit. Numerical experiments have confirmed the effectiveness of the algorithm named as "3:2"-class: in this case, we take into account 3 digits of the dividend and 2 digits of the divisor to obtain one digit of the result.

These algorithms are necessary to work with rational numbers and for more complex calculations on their basis (for example, to solve systems of linear algebraic equations). In future, this version may be a prototype for more efficient redesign, especially with use of binary algorithms implemented in modern processors.

Key words: electronic spreadsheet, Excel Add-In, symbolic computations, dividing algorithms.




DOI: http://dx.doi.org/10.30970/eli.11.8

Refbacks

  • There are currently no refbacks.