计算机工程与应用 ›› 2017, Vol. 53 ›› Issue (14): 51-55.DOI: 10.3778/j.issn.1002-8331.1603-0150

• 理论与研发 • 上一篇    下一篇

超高精度计算程序设计实例

马  旭   

  1. 辽宁大学 计算中心,沈阳 110036
  • 出版日期:2017-07-15 发布日期:2017-08-01

Programming examples based on super high precision calculation

MA Xu   

  1. Computing Center, Liaoning University, Shenyang 110036, China
  • Online:2017-07-15 Published:2017-08-01

摘要: 针对工程实践中时常出现超高精度计算的程序设计需求,分析超高精度乘、除法运算规则,提出超高精度整数与普通整数的乘除法运算算法及两个超高精度整数的乘除法运算算法,并分别给出时间复杂度分析及实验数据。给出3个完整的C语言程序,分别完成指定整数高次幂的精确计算并输出、按超高精度要求输出两个普通整数的商、超高精度求圆周率并输出。实验结果证明,在现有的常规软件及语言下,提出的超高精度计算的程序设计方法在工程实践中是简单可行的。

关键词: 超高精度乘法算法, 超高精度除法算法, 整数高次幂, 超高精度圆周率, 完整C程序

Abstract: In view of the requirements of the program design of super high precision calculation in engineering practice, the paper analyzes the rules of super high precision multiplication and division operation. It proposes the multiplication and division algorithm of super high precision integer and normal integer, and of two super high precision integers, and also offers experimental data respectively. In addition, the paper provides three complete C language programs, which accurately calculate and output the specified higher power of an integer, and the quotient of two ordinary integers according to the super high precision requirements, and the super high precision of PI respectively. The experimental results show that under the condition of the existing conventional software and language, those proposed methods are simple and feasible in engineering practice.

Key words: super high precision multiplication algorithm, super high precision division algorithm, higher power of integer, super high precision of PI, complete C program