|
|||
Development of an Arithmetic Operation System of a Variable Digit Number Type
by Hisashi Ito
CASIO COMPUTER CO., LTD. 2-1, Sakaecho 3-chome, Hamura-shi, Tokyo 205-8555, Japan Abstract In the present operation system, the length of numbers of the significand of the numeral register group and the number of operation Words of micro instructions can be switched on the hardware by changing a digit-number parameter. Therefore, the present operation system is switched to 7-digit calculation system, 11-digit calculation system, ..... 55-digit calculation system without changing micro instruction and function program. The present operation system is effectively used for calculation requiring accuracy, and for calculation to confirm calculation accuracy. 1. Introduction The conventional floating-point operation system specified in IEEE Standard 754 comprises binary-number operation systems corresponding to data representation formats such as a single-precision, a double-precision, and an expanded double-precision format. The conventional operation system coerces program creators to pay much attention to management of numeric data representation format and calculation types. Further, in the conventional operation system, it is very hard to change the digit number of numeric data to be processed, after completion of an operation program, and in particular it is extremely difficult to change the digit number to that higher than 20 digits (Refer to Fig. 1). In the conventional operation system, calculations are carried out in connection with binary numbers, and therefore decimal to binary conversion of floating-point data can cause errors. The conventional operation system, which places importance on performance of recent hardware has not been improved in these 20 years (Refer to Fig. 2). The present arithmetic operation system has been developed with the aim of configuring an ¡°arithmetic operation system closer to human thinking¡± in the background of enhanced performance of recent hardware rather than an ¡°operation system which places importance on performance of a computer¡± (Refer to Fig. 3). 2. Features of the present arithmetic operation system
3. Principal of the present arithmetic operation system The principal of the present arithmetic operation system resides in that ¡°digit number is changed simply by changing a digit-number parameter for all the operations including those from micro instructions of a machine-language level to high degree functional calculuses¡±. The present arithmetic operation system comprises a computing unit, a numeric register group, a program memory and the digit-number parameters (Refer to Fig.5). The computing unit with a bus width of one word (16-bits) performs decimal and binary system calculations. The numeric register group includes plural registers each consisting of 16 words. In the program memory are stored the micro instruction groups, each instruction prepared for continuously performing operations in connection with plural words. The micro instruction groups have direct address instructions (for example, X0~1 + Y) and indirect address instructions (for example, XV~15 + Yd) subject to a digit-number parameter V. The micro instruction groups further have a unique instruction Vset, for setting an arbitrary address to the digit-number parameter V, which specifies the start address of the indirect address instruction. With reference to an operation program shown by way of example in Fig. 6, it will be explained that since calculation of the significand consists of an indirect address instruction, such calculation can be carried out by changing a digit number. A number ¡°4¡± is set to the digit-number parameter V at 4>Vset instruction (Refer to stage (1)). Since the start address is switched to the value of the digit-number parameter V, the indirect address operation instruction of XV~15 + Yd, where ¡°d¡± designates calculation of the decadal system, shall be equivalent to the direct address instruction of X4~15 + Yd, that is, a decade addition instruction of continuous twelve Words (Refer to stage (2)). Then, when the unique instruction Vset is changed to a number ¡°14¡± at 14>Vset instruction (Refer to stage (1)), the indirect address operation instruction of XV~15 + Yd is carried out as the decade addition instruction of continuous two Words X14~15 + Yd (Refer to stage (2)). In other words, when the digit-number parameter V is changed to a certain value, the start address of the indirect address operation instruction is switched to the certain value thereafter, and the digit number for the calculation will be obtained by calculating the term of [(end address - start address) * 4 + 3]. Therefore, if the instruction to calculate the significand is written only with indirect address instructions, the operation system of a variable digit number will be configured. Meanwhile, if a calculation instruction of the direct address X0~1 + Y is used, calculation of the exponent with a fixed digit number will be a calculation system of a fixed two Words at all times. Once a digit-number parameter is input, the digit number for the numeric register group and the micro instruction group is set to the digit number corresponding to the input digit-number parameter. Since various arithmetic operation programs including elementary functions are configured using micro instruction groups subject to the digit number parameter, a mechanism of a variable digit number can be established with hardware only. A programmer can develop software running on such hardware without paying attention to the concept of digit-number variation.(Refer to Fig. 7) The operation system as studied above has been realized using FPGA. In the operation system, a personal computer and FPGA are connected with each other through USB interface, and the personal computer executes input/output performances and FPGA carries out arithmetic operations. The operation system is designed to operate at a frequency of 20 MHz. 4. Application and development to numerical calculations of advanced functions The architecture of the above operation system of a variable digit number type is configured with an extremely compact CPU, and has unique instruction sets optimized for numeric calculations. For practical use, the numeric calculation program has been configured with the assembler language to optimize the program size and the operation speed. Under the condition that all numerical calculations of functions are performed in the decimal system of a variable digit number type, programs for functional calculations have been written. At present, operation programs for the functions set forth below have been created and can be used for numeric calculations and for displaying graphs. Operation programs for zeros calculation of Bessel functions as the inverse calculation by Newton¡¯s method, and ¦Ö and ¦Ë calculations of the statistic distribution function have been created. Elementary functions and some special functions have been applied to complex number calculations. Elementary functions: £«,£,£ª,£¯, ¡Ì, logx, lnx, 10x, ex, xy sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh Special functions: ¦£(x), ¦¢(x,y), ln¦£(x), Erf(x), Erfc(x), lc¦£(x,a), Ic¦¢(x,a,b) Bessel J¦Í(x), Y¦Í(x), I¦Í(x), K¦Í(x), jn(x), yn(x), in(x), kn(x), Ai(x), Bi(x) Statistic distribution functions: N(x), ¦Ö2(¦Í,x), t(¦Í,x), F(¦Í1,¦Í2,x), nc-¦Ö2(¦Í,¦Ë,x), nc-t(¦Í,¦Ë,x), nc-F(¦Í1,¦Í2,¦Ë,x) 5. Result of measurement of operation times and consideration of operation precision Operation times required for carrying out calculations at 20 MHz have been measured with respect to a trigonometric function, ¦£ function, and a normal distribution function, and the results thereof are shown in Fig. 8. The operation times increase proportionally as the digit number increases. The operation precision and the digit number may be selected without any restriction, as appropriate. At the selection, there is no need to change the operation program. The operation time for performing the calculation of a ¦£ function is approximately 15 ms with a 55 digit number and approximately 1 ms with a 7 digit number, and a graph of 1000 dots can be drawn in about 1 second. The present operation system has much practical use. In consideration of recent advancements in the development of the semiconductor¡¡technology, significant enhancement of operation performance is expected. Operation precision in the calculation of a ¦£ function has been studied, the result of which is shown in Fig. 9. The calculation results for various digit numbers meet the true values except approximately 2 digits in the two least significant digit positions (preciseness of ±100). Fig. 9 shows that, even though various operations including the four basic operations, logarithmic operations, and exponential operations are performed in the course of calculation of ¦£ function, the resultant is obtained with considerable precision. 6. Mathematical formula calculating system Further, the present operation system has been developed from a system for calculating a single function to a system for calculating mathematical formula. In an example shown in Fig. 10, when a calculation formula of PMT*((1+r)n - 1)/r is input for calculating the total of the accumulated funds (FV), variables necessary for such calculation are automatically determined, and input of the variables such as an amount of fund reserved each time ¡°PMT¡±, an interest rate ¡°r¡±, the number of times of reserves ¡°n¡± is urged. When particular values are set for these variables and the calculation of the formula is carried out, the total of the accumulated funds (FV) is obtained at a Answer. When an initial value ¡°1¡± for the number of times of reserves ¡°n¡±, ¡°1¡± for steps, and ¡°10¡± for a frequency of calculations, that is, n=1, 1, 10 are entered, calculations are carried out, and the calculated total of the accumulated fund is displayed in table every reserve of the fund (Refer to Fig. 10). As described above, the present mathematical formula calculating system can carry out a wide variety of calculations for practical uses, requiring no operation program, and is easy to understand and to use. Further, many devices have been made with respect to precision of calculation in the present operation system. In an example of calculation shown in Fig. 11, the calculation of (1+r)n -1 can invite an error because of information loss. When an equation (1+r)n -1=exp(n*ln(1+r)) -1 is calculated, calculation of terms ln(1+r) and exp(x) -1 will invite great errors in case of £üx£ü<<1. To avoid the problem, in ¡°ISO/IEC9899:1999 -Programming Language C¡± are added a new functions log1p(x)=log(1+x) and expml(x)=exp(x)-1. But a programmer is required to use both log(x) and loglp(x) appropriately depending on situations. In the present operation system, ln(1+x), log(1+x), ex -1, 10x -1, (1+x)x, xx -1, (1+x)x -1 are automatically judged, and a special calculating process is executed, preventing occurrence of a large calculation error. Further, in case of a term of ln(a+x), where a variable a=1, a special calculating process is executed, and therefore the present equation calculating system does not require the user to pay special attention for maintaining a calculation accuracy. 7. Application and development in the future In future development, the present arithmetic operation system of a variable digit number type will be enhanced to perform operations of many special functions, including complex number operation, which have not yet been installed. Calculation service will be provided on the Web, where many users are allowed to use the present arithmetic operation system conveniently without any restriction. The present arithmetic operation system will be further improved to meet various future requirements which will greatly contribute to the development of science and technology. References: [1] IEEE Std 754-1985 [2] Handbook of Mathematical Functions, With Formulas, Graphs, and Mathematical Tables, by Abramowitz, M. and Stegun, I. A. [3] ISO/IEC9899:1999 -Programming Language C |
Home | Feedback | Register | Site Map |
All material on this site Copyright © 2017 Design And Reuse S.A. All rights reserved. |