摘 要:通過對(duì)人工計(jì)算法的分析和模擬,提出一種利用VIUAL FOXPRO環(huán)境提供的工作界面,用于實(shí)現(xiàn)計(jì)算機(jī)不能實(shí)現(xiàn)的對(duì)任意長(zhǎng)度的長(zhǎng)整數(shù)位數(shù)的精確計(jì)算,最后給出具體的編程方法和操作步驟。
關(guān)鍵詞:數(shù)組;算法;VFP 07000;長(zhǎng)整數(shù)位數(shù)
Accurate Calculation of Long Integer Based on VFP Using Array
YANG Cuiping1,CENG Runmei2
(1Zhangjiakou Vocational College of echnology,Zhangjiakou,07000,China;2Fifth econdary of Zhangjiakou,Zhangjiakou,07000,China)
Abstract:Based on analysis and simulation the calculation method of,which makes use of VIUAL FOXPRO environment,the work of interface for the computer impossible for any length of the median length of precision integer calculation,and specific programming methods and procedures are given
Keywords:array;algorithm;VFP;long integer
1 引 言
科學(xué)計(jì)算是計(jì)算機(jī)的一個(gè)最重要功能,利用一些函數(shù)和各種運(yùn)算符號(hào)可以進(jìn)行任何復(fù)雜的數(shù)學(xué)運(yùn)算。但由于計(jì)算機(jī)內(nèi)存空間的限制,計(jì)算機(jī)在計(jì)算很大的數(shù)據(jù)時(shí),往往是用科學(xué)記數(shù)法表示。比如在VFP60和其他的一些高級(jí)編程語言中,計(jì)算機(jī)所能處理的長(zhǎng)整數(shù)的范圍是從-2 147 483 648 到2 147 483 647。也就是說超出這個(gè)范圍的整數(shù)計(jì)算機(jī)就不能處理甚至不能識(shí)別,那時(shí)計(jì)算機(jī)就會(huì)把數(shù)據(jù)轉(zhuǎn)換為科學(xué)記數(shù)法后再進(jìn)行處理。因此需要知道2個(gè)很大的整數(shù)相乘的精確結(jié)果,看起來是很難實(shí)現(xiàn)。因?yàn)橛?jì)算機(jī)不支持很長(zhǎng)的位數(shù)計(jì)算。然而,只要愿意去做,就可以讓計(jì)算機(jī)來模擬人工計(jì)算的方式進(jìn)行計(jì)算,并且也不會(huì)超出計(jì)算機(jī)的整數(shù)計(jì)算范圍。本文就是通過對(duì)人工計(jì)算步驟的分析和模擬,最后找出一個(gè)算法,用數(shù)據(jù)庫(kù)語言實(shí)現(xiàn)長(zhǎng)整數(shù)的精確計(jì)算。
2 人工計(jì)算步驟的分析和模擬
首先分析用人工進(jìn)行乘法計(jì)算的過程