#module m_plus_double #deffunc local init basis_large=100000.0*100000.0*100000.0*100000.0 basis_small=100000.0*100000.0 basis4muldiv=100000.0*100000.0 return // 掛け算と割り算の対象はdoubleだけ #deffunc local mul_value var p_value,var p4mul,double p_arg p_value*=p_arg if p_value>=basis_large{ p_value/=basis4muldiv p4mul+=10 } if p_value<=basis_small{ if p4mul>=1{ p_value*=basis4muldiv p4mul-=10 } } return // 掛け算と割り算の対象はdoubleだけ #deffunc local div_value var p_value,var p4mul,double p_arg p_value/=p_arg if p_value>=basis_large{ p_value/=basis4muldiv p4mul+=10 } if p_value<=basis_small{ if p4mul>=1{ p_value*=basis4muldiv p4mul-=10 } } return #deffunc local sub_value var _p_value,var _p4mul,var _arg_value,var _arg4mul set_place@m_plus_double _p_value,_p4mul,_arg_value,_arg4mul _p_value-=_arg_value if p_value>=basis_large{ p_value/=basis4muldiv p4mul+=10 } if p_value<=basis_small{ if p4mul>=1{ p_value*=basis4muldiv p4mul-=10 } } return #deffunc local add_value var _p_value,var _p4mul,var _arg_value,var _arg4mul set_place@m_plus_double _p_value,_p4mul,_arg_value,_arg4mul _p_value+=_arg_value if p_value>=basis_large{ p_value/=basis4muldiv p4mul+=10 } if p_value<=basis_small{ if p4mul>=1{ p_value*=basis4muldiv p4mul-=10 } } return // 〔隣り合って置く〕place #deffunc local set_place var _p_value,var _p4mul,var _arg_value,var _arg4mul if _p4mul>_arg4mul{ while _p4mul > _arg4mul _arg4mul+=10 _arg_value/=basis4muldiv wend }else{ while _p4mul < _arg4mul _p4mul+=10 _p_value/=basis4muldiv wend } return #defcfunc local is_big var _p_value,var _p4mul,var _arg_value,var _arg4mul if _p4mul>_arg4mul:return 1 if _p4mul<_arg4mul:return 0 // p4mul==arg4mulのはず if _p_value>_arg_value:return 1 if _p_value<_arg_value:return 0 return -1 #defcfunc local is_small var _p_value,var _p4mul,var _arg_value,var _arg4mul if _p4mul>_arg4mul:return 0 if _p4mul<_arg4mul:return 1 // p4mul==arg4mulのはず if _p_value>_arg_value:return 0 if _p_value<_arg_value:return 1 return -1 #deffunc local dump var _p_value,var _p4mul if _p4mul<=0{ logmes ""+_p_value+" 10^"+_p4mul }else{ logmes ""+dbl_trim(_p_value)+" 10^"+_p4mul } return #global #module #defcfunc dbl_trim double p n=str(p) getstr piyo,n,0,'.' return piyo #global /* 以下 TEST CODE init@m_plus_double tmp_value=1.0 tmp_mul=0 repeat 30 mul_value@m_plus_double tmp_value,tmp_mul,20.0 dump@m_plus_double tmp_value,tmp_mul loop repeat 30 div_value@m_plus_double tmp_value,tmp_mul,20.0 dump@m_plus_double tmp_value,tmp_mul loop tmptmpA_value=123.0 tmptmpA_mul=50 tmptmpB_value=125.0 tmptmpB_mul=70 logmes ""+is_big@m_plus_double(tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul) tmptmpA_value=123.0 tmptmpA_mul=70 tmptmpB_value=125.0 tmptmpB_mul=50 logmes ""+is_big@m_plus_double(tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul) tmptmpA_value=123.0 tmptmpA_mul=50 tmptmpB_value=125.0 tmptmpB_mul=50 logmes ""+is_big@m_plus_double(tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul) tmptmpA_value=127.0 tmptmpA_mul=50 tmptmpB_value=125.0 tmptmpB_mul=50 logmes ""+is_big@m_plus_double(tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul) tmptmpA_value=123.0 tmptmpA_mul=50 tmptmpB_value=125.0 tmptmpB_mul=70 logmes ""+is_small@m_plus_double(tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul) tmptmpA_value=123.0 tmptmpA_mul=70 tmptmpB_value=125.0 tmptmpB_mul=50 logmes ""+is_small@m_plus_double(tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul) tmptmpA_value=123.0 tmptmpA_mul=50 tmptmpB_value=125.0 tmptmpB_mul=50 logmes ""+is_small@m_plus_double(tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul) tmptmpA_value=127.0 tmptmpA_mul=50 tmptmpB_value=125.0 tmptmpB_mul=50 logmes ""+is_small@m_plus_double(tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul) tmptmpA_value=127.0 tmptmpA_mul=60 tmptmpB_value=125.0 tmptmpB_mul=50 add_value@m_plus_double tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul dump@m_plus_double tmptmpA_value,tmptmpA_mul tmptmpA_value=127.0 tmptmpA_mul=50 tmptmpB_value=125.0 tmptmpB_mul=60 add_value@m_plus_double tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul dump@m_plus_double tmptmpA_value,tmptmpA_mul tmptmpA_value=127.0 tmptmpA_mul=40 tmptmpB_value=125.0 tmptmpB_mul=40 add_value@m_plus_double tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul dump@m_plus_double tmptmpA_value,tmptmpA_mul tmptmpA_value=127.0 tmptmpA_mul=60 tmptmpB_value=125.0 tmptmpB_mul=50 sub_value@m_plus_double tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul dump@m_plus_double tmptmpA_value,tmptmpA_mul tmptmpA_value=127.0 tmptmpA_mul=50 tmptmpB_value=125.0 tmptmpB_mul=60 sub_value@m_plus_double tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul dump@m_plus_double tmptmpA_value,tmptmpA_mul tmptmpA_value=127.0 tmptmpA_mul=40 tmptmpB_value=125.0 tmptmpB_mul=40 sub_value@m_plus_double tmptmpA_value,tmptmpA_mul,tmptmpB_value,tmptmpB_mul dump@m_plus_double tmptmpA_value,tmptmpA_mul //*/