摘要
在程序设计中,每种数据类型有数值范围限制,若两个位数较长的大数值整数相乘,积容易溢出,一般处理对策是将整数乘法转换成浮点乘法以提高计算精度,拓宽数值计算的范围。文章分析了印度数学家婆什伽罗名著《丽罗娃提》中的格子乘法规则,借用三维数组替代格子乘法中斜线宫格,将两个大整数每个位数进行交叉相乘,利用程序设计的循环结构将斜线宫格中的同位数值进行相加、依次进位,完成了大整数乘法算法研究,并给出了c++语言的实现代码。
In program design, each type of data in a numerical range limit, if two digits longer numerical large integer multiplication, the product is easy to overflow, the general processing strategy is will integer multiplication is converted into floating point multiplication in order to improve the calculafon precision, and to broaden the scope of numerical calculation. Based on the analysis of the Indian mathematician Bhaskara classics the Lirova provided in lattice multiplication rule, use the three dimensional array of alternatives multiplication grid diagonal grids, each two big integer number were cross multiplication, will slash grids in the same bit values are added together, in order to carry, the completion of the large integer multiplication algorithm using loop structure of the program design, and gives the C + + language implementation code.
出处
《电脑与信息技术》
2016年第4期16-18,共3页
Computer and Information Technology
关键词
数据类型
格子乘法
三维数组
位相乘
data type
lattice multiplication
three-dimensional array
bit multiplication