LONG ARITHMETIC IN EXCEL. II. RATIONAL NUMBERS

Vitaly Fourman, M. Khomyak, Ya. Marko

Abstract


Within VBA and Excel framework the arithmetic operations for rational numbers with arbitrary digits in the fraction "numerator per denominator" are implemented. Symbolic calculations work with their representation in electronic spreadsheet cells as text and full precision integer algorithms. Using the object-oriented approach, a typical interface of the class SRational is constructed and its functionality is described. Class methods can be grouped as constructors, arithmetic operators and functions to print a rational number back into a symbolic string. Constructors convert symbols into internal representations as arrays of digits. The result of some operation can be returned to the user as one of the intuitive formats, in particular, as a fraction with a separated integer part, or as a triple of numbers, or as an arithmetic expression. Also a routine to simplify the fraction "on demand"  is implemented, which is not always necessary in the intermediate calculations.

There is provided a multivariate symbolic representation of rational numbers structurally having up to three fields: an integer, a numerator, and a denominator. Between them can be intuitive separators, in particular, symbols of arithmetic operations and brackets. To calculate arithmetic expressions, we use their representations as binary trees. The complex of the functionality to parse rational numbers in the symbolic input information is analyzed.

Instead of manual input of large rational numbers, you can use already formed arrays. Therefore, data import from text files of various formats is important. It provides interaction with other programs.

Key words: EXCEL Add-In, rational numbers, full precision algorithm, symbolic computation, binary tree.




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

Refbacks

  • There are currently no refbacks.