#include "longint.hsp" #module m_one_plus_float member_inner_value,member_LI_value,member_decimal_type,member_LI_decimal,member_double_decimal,member_decimal_places,member_after_mul,member_after_DIV #modinit if _keta_flag==0{ _10keta=LongInt(100000) _10keta*=100000 _keta_flag=1 } member_inner_value=LongInt(0) member_LI_value=LongInt(0) member_LI_decimal=LongInt(0) member_decimal_type=8 member_double_decimal=0.0 member_decimal_places=10 member_after_mul=1 // 後でこの値で割ってね member_after_div_at_inner=LongInt(1) // decimal:小数 // place:桁 return // 10桁小数に決め打ち計算 #modfunc local inner2value member_LI_value=member_inner_value/_10keta if member_decimal_places==10{ member_LI_decimal = member_inner_value\_10keta return } if member_decimal_places==4{ member_LI_decimal = member_inner_value\_10keta member_LI_decimal/=(1000*1000) return } logmes "error inner2value@m_one_plus_float placesの値が10か4ではありません" return #modfunc local value2inner member_inner_value=member_LI_value member_inner_value*=100000 member_inner_value*=100000 member_after_div_at_inner=LongInt(1) member_after_div_inner*=100000 member_after_div_inner*=100000 if member_decimal_places==10{ member_inner_value+=member_LI_decimal return } if member_decimal_places==4{ member_inner_value+=(member_LI_decimal*1000*1000) return } logmes "error value2inner@m_one_plus_float placesの値が10か4ではありません" return #modfunc local dbl2LI member_double_decimal*=100000 member_double_decimal*=100000 member_LI_decimal=LongInt(member_double_decimal) member_double_decimal=0.0 member_decimal_type=8 member_decimal_places=10 return #modfunc local dump logmes "LI_value:"+str(member_LI_value) logmes "LI_type:"+str(vartype(member_LI_value)) logmes "LI_decimal:"+str(member_LI_decimal) logmes "decimal_type:"+str(member_decimal_type) logmes "LI_double:"+str(member_double_decimal) logmes "桁(小数):"+str(member_decimal_places) ; logmes "_10keta:"+str(_10keta) logmes "after_mul:"+str(member_after_mul) logmes "after_div:"+str(member_after_div) return #modfunc local cut_by_10keta member_LI_decimal\=_10keta return #modfunc local cut_by_4keta member_LI_decimal\=_10keta member_LI_decimal/=1000000 return // もっと大きい桁の計算で使いそう #modfunc local cut_by_x_keta int p_keta,local loc_10kai loc_10kai=LongInt(1) repeat p_keta loc_10kai*=10 loop member_LI_decimal\=loc_10kai return #modfunc local set_values var _p_value,var _p_decimal,int _p_places member_LI_value=LongInt(_p_value) member_decimal_type=vartype(_p_decimal) if member_decimal_type==3{ member_decimal_type=3 member_double_decimal=_p_decimal }else{ member_LI_decimal=LongInt(_p_decimal) member_decimal_type=vartype(member_LI_decimal) } member_decimal_places=_p_places return #modfunc local set_after_mul var _p_after_mul member_after_mul=_p_after_mul return #modfunc local set_after_div var _p_after_div member_after_div=_p_after_div return #global #module m_plus_float arg_1st_mf_obj,obj_operand,arg_2nd_mf_obj #modinit newmod arg_1st_mf_obj,m_one_plus_float obj_operand="" // operand:演算子 newmod arg_2nd_mf_obj,m_one_plus_float return #modfunc local dump logmes "1st arg" dump@m_one_plus_float arg_1st_mf_obj logmes "演算:"+obj_operand logmes "2nd arg" dump@m_one_plus_float arg_2nd_mf_obj return #modfunc local set_operand str p_operand obj_operand=p_operand return #modfunc local set_arg_1st_values var p_value,var p_decimal,int p_places set_values@m_one_plus_float arg_1st_mf_obj,p_value,p_decimal,p_places return #modfunc local set_arg_2nd_values var p_value,var p_decimal,int p_places set_values@m_one_plus_float arg_2nd_mf_obj,p_value,p_decimal,p_places return #modfunc local dbl2LI_1st dbl2LI@m_one_plus_float arg_1st_mf_obj return #modfunc local dbl2LI_2nd dbl2LI@m_one_plus_float arg_2nd_mf_obj return #modfunc local cut_by_10keta_1st cut_by_10keta@m_one_plus_float arg_1st_mf_obj return #modfunc local cut_by_4keta_1st cut_by_4keta@m_one_plus_float arg_1st_mf_obj return #modfunc local cut_by_10keta_2nd cut_by_10keta@m_one_plus_float arg_2nd_mf_obj return #modfunc local cut_by_4keta_2nd cut_by_4keta@m_one_plus_float arg_2nd_mf_obj return #global newmod tmp_LI,m_plus_float tmp_l1=LongInt(12345678) tmp_l1*=100000000 tmp_l1+=12345678 tmp_l2=LongInt(56781234) tmp_l2*=100000000 tmp_l2+=56781234 tmp_l3=10 ;logmes str(vartype(tmp_l1)) set_arg_1st_values@m_plus_float tmp_LI,tmp_l1,tmp_l2,tmp_l3 set_operand@m_plus_float tmp_LI,"SUB" tmp_arg_l1=LongInt("8765432187654321") ;tmp_arg_l2=LongInt("4321876543218765") tmp_arg_l2=0.12345 tmp_arg_l3=10 set_arg_2nd_values@m_plus_float tmp_LI,tmp_arg_l1,tmp_arg_l2,tmp_arg_l3 logmes "++begin" dump@m_plus_float tmp_LI dbl2LI_2nd@m_plus_float tmp_LI logmes "++2LI" dump@m_plus_float tmp_LI cut_by_10keta_1st@m_plus_float tmp_LI cut_by_10keta_2nd@m_plus_float tmp_LI logmes "++cut_by_10keta" dump@m_plus_float tmp_LI cut_by_4keta_1st@m_plus_float tmp_LI cut_by_4keta_2nd@m_plus_float tmp_LI logmes "++cut_by_4keta" dump@m_plus_float tmp_LI newmod tmp_LI_2nd,m_plus_float tmp_l1=12345 tmp_l2=67890 tmp_l3=10 ;logmes str(vartype(tmp_l1)) set_arg_1st_values@m_plus_float tmp_LI_2nd,tmp_l1,tmp_l2,tmp_l3 set_operand@m_plus_float tmp_LI_2nd,"MUL" tmp_arg_l1=LongInt("8765432187654321") ;tmp_arg_l2=LongInt("4321876543218765") tmp_arg_l2=0.12345 tmp_arg_l3=10 set_arg_2nd_values@m_plus_float tmp_LI_2nd,tmp_arg_l1,tmp_arg_l2,tmp_arg_l3 logmes "++begin_2nd" dump@m_plus_float tmp_LI_2nd