#module
#defcfunc comp_h int a,int b
if a<b :return b
return a
#defcfunc comp_l int a,int b
if a<b :return a
return b
#deffunc fteki var keka_,var size1_,var ten1_
k1=size1_-ten1_-1-1
sdim keka_2,size1_
sik=0
sij=0
repeat
if peek(keka_,k1+ten1_+1)=0:sik+:else:break
k1-
loop
k1=-ten1_-1
repeat
if peek(keka_,k1+ten1_+1)=0:sij+:else:break
k1+
loop
size1_-=sik+sij
ten1_=sij
memcpy keka_2,keka_,size1_,0,sij
memcpy keka_,keka_2,size1_,0,0
return
#deffunc fzetai var hiki2_,int size2_,int ten2_,int sehu2_, var hiki3_,int size3_,int ten3_,int sehu3_
size1_=comp_h(ten2_+1,ten3_+1)+comp_h(size2_-ten2_-1,size3_-ten3_-1)+1
ten1_=comp_h(ten2_,ten3_)+1
k1=size1_-ten1_-1-1
repeat
st1=0
st2=0
if k1<=size2_-ten2_-1-1&&k1>=-ten2_-1{
st1=((sehu2_!1)*2-1)*peek(hiki2_,k1+ten2_+1)
}
if k1<=size3_-ten3_-1-1&&k1>=-ten3_-1{
st2=((sehu3_!1)*2-1)*peek(hiki3_,k1+ten3_+1)
}
st3=st1+st2+kuri
kuri=0
if st3>=10:st3-=10:kuri=1
if st3<0:st3+=10:kuri=-1
k1-
if k1<-(ten1_+1):break
loop
if kuri!=0:return 1
return
return
#deffunc fplus var keka_3,var size1,var ten1,var sehu1, var hiki2,int size2,int ten2,int sehu2, var hiki3,int size3,int ten3,int sehu3
fzetai hiki2, size2, ten2, sehu2, hiki3, size3, ten3, sehu3
han=1
if stat=1:han=-1
size1=comp_h(ten2+1,ten3+1)+comp_h(size2-ten2-1,size3-ten3-1)+1
ten1=comp_h(ten2,ten3)+1
sdim keka_3,size1
sdim keka,size1
k1=size1-ten1-1-1
kuri=0
repeat
st1=0
st2=0
if k1<=size2-ten2-1-1&&k1>=-ten2-1{
st1=han*((sehu2!1)*2-1)*peek(hiki2,k1+ten2+1)
}
if k1<=size3-ten3-1-1&&k1>=-ten3-1{
st2=han*((sehu3!1)*2-1)*peek(hiki3,k1+ten3+1)
}
st3=st1+st2+kuri
kuri=0
if st3>=10:st3-=10:kuri=1
if st3<0:st3+=10:kuri=-1
poke keka,k1+ten1+1,st3
k1-
if k1<-(ten1+1):break
loop
sehu1=((han+1)/2!1)
fteki keka ,size1 ,ten1
;if kuri!=0:dialog "エラー"
memcpy keka_3,keka,size1,0,0
return
#global
a=""
size2=30
ten2=0//1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
sdim suti1,size2
//配列にデータをいれます (π)
poke suti1,0,3
poke suti1,1,1
poke suti1,2,4
poke suti1,3,1
poke suti1,4,5
poke suti1,5,9
poke suti1,6,2
poke suti1,7,6
poke suti1,8,5
poke suti1,9,3
poke suti1,10,5
poke suti1,11,8
poke suti1,12,9
poke suti1,13,0
poke suti1,14,9
poke suti1,15,3
poke suti1,16,2
poke suti1,17,3
poke suti1,18,8
poke suti1,19,4
poke suti1,20,6
poke suti1,21,2
poke suti1,22,6
poke suti1,23,4
poke suti1,24,3
poke suti1,25,3
poke suti1,26,8
poke suti1,27,3
poke suti1,28,0
poke suti1,29,0
size3=2
sdim suti3,size3
poke suti1,0,3
ten3=0
sehu3=0
sehu2=0
//fplus 代入される変数,サイズ,小数点位置 足す変数,サイズ,小数点位置 足される変数,サイズ,小数点位置
fplus suti,size,ten,sehu,suti1,size2,ten2,sehu2,suti3,size3,ten3,sehu3
//結果はデバッグウィンドウのメモリダンプで・・・
mes size1
mes ten1
2008年9月23日火曜日
任意桁数の実数計算
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿