java自定义大数(进制可在2-62之间相互转换)
更新时间:2023-12-01 23:26:01 阅读量: 教育文库 文档下载
- java 自定义进制推荐度:
- 相关推荐
java自定义大数(进制可在2~62之间相互转化)
闲着没事做,写了一个自定义大数,并实现了两个大数的加减乘除以及比较,
以及2~62进制任意数(包括但不限于正整数与负整数)的相互转化
大数类: BigNumber.java /*
* 0~9用0~9表示,10~35用A~Z表示,36~61用a~z表示 */
@SuppressWarnings(\)
public class BigNumber extends Exception{
private String MyNumber;//大数 private int SystemNumber;//进制数 public BigNumber(){ }
this(\,10);
public BigNumber(String MyNumber){ this(MyNumber,10);
}
public BigNumber(String MyNumber,int SystemNumber){ this.MyNumber=MyNumber;
this.SystemNumber=SystemNumber; this.Islegal();
}
public String getMyNumber() { }
public void setMyNumber(String myNumber) { }
public int getSystemNumber() { }
public void setSystemNumber(int systemNumber) { }
this.SystemNumber = systemNumber; return this.SystemNumber; this.MyNumber = myNumber; return this.MyNumber;
public void Islegal(){//判断该字符串是否合法
if(this.MyNumber==null||this.MyNumber.length()==0){//大数为空或大数字符串长度为0
throw (new NumberFormatException(\错误!大数为空或大数字符串长度为0
\+this.MyNumber)); }
if(this.SystemNumber<=1||this.SystemNumber>=63){//进制数不合法
throw (new NumberFormatException(\错误!进制数不合法
\+this.SystemNumber)); }
if(this.MyNumber.equals(\)||this.MyNumber.equals(\)||this.MyNumber.
throw (new NumberFormatException(\错误!大数不合法 \+this.MyNumber));
equals(\)){ }
if(this.MyNumber.equals(\)||this.MyNumber.equals(\)){ }
for(int i=0,a,k=-1;i protected static String Add_Positive(String s1,String s2,int n){//自定义两个正数加法运算 String Ins1=getInteger(s1),Dos1=getDecimal(s1),Ins2=getInteger(s2),Dos2=getDecimal(s2);//分别获取整数部分及小数部分 int Inlength=Math.max(Ins1.length(), Ins2.length()),Dolength=Math.max(Dos1.length(), Dos2.length()); Ins1=AddToLeft(Ins1,Inlength+1)+AddToRight(Dos1,Dolength); Ins2=AddToLeft(Ins2,Inlength+1)+AddToRight(Dos2,Dolength); String s=\; for(int i=Inlength+Dolength,m,y=0;i>=0;i--){ m=Chartoint(Ins1.charAt(i))+Chartoint(Ins2.charAt(i))+y; s=Inttochar(m%n)+s; a=Chartoint(this.MyNumber.charAt(i)); if(i!=0&&(a==-1||a==-2)){ } if(a>=this.SystemNumber||a==-4){ } if(a==-3){ } if(k==-1){ } k=i; throw (new NumberFormatException(\错误!出现了第二个小数点 }else{ throw (new NumberFormatException(\错误!该字符不在该进制合法字符中 throw (new NumberFormatException(\错误!符号位只能在大数首部 throw (new NumberFormatException(\错误!大数不合法 \+this.MyNumber)); \+this.MyNumber.charAt(i)+\+i+\)); \+this.MyNumber.charAt(i)+\+i+\)); \+this.MyNumber.charAt(i)+\+i+\)); } y=m/n; int pointplace=s.length()-Dolength; s=Format(s.substring(0,pointplace)+\+s.substring(pointplace),true); return s; } protected static String Sub_Positive(String s1,String s2,int n){//自定义两个正数减法运算; if(ComparetoString(s1,s2)<0){//如果s1 return \+Sub_Positive(s2,s1,n); } String Ins1=getInteger(s1),Dos1=getDecimal(s1),Ins2=getInteger(s2),Dos2=getDecimal(s2);//分别获取整数部分及小数部分 int Inlength=Math.max(Ins1.length(), Ins2.length()),Dolength=Math.max(Dos1.length(), Dos2.length()); String R=getComplement(new BigNumber(AddToLeft(Ins2,Inlength)+\+AddToRight(Dos2,Dolength),n)).MyNumber; R=Add_Positive(s1,R,n); s2=\+AddToLeft(\,Dolength); R=Add_Positive(R,s2,n); return Format(R.substring(1),true); } protected static String Mult_Positive(String s1,String s2,int n){//自定义两个正数乘法运算; String Ins1=getInteger(s1),Dos1=getDecimal(s1),Ins2=getInteger(s2),Dos2=getDecimal(s2);//分别获取整数部分及小数部分 Ins1+=Dos1; Ins2+=Dos2; int[]A=new int[Ins1.length()+Ins2.length()-1]; for(int i=Ins1.length()-1;i>=0;i--){ } String s=\; for(int i=A.length-1;i>=1;i--){ } s=Inttochar(A[i]%n)+s; A[i-1]+=A[i]/n; for(int j=Ins2.length()-1;j>=0;j--){ } A[i+j]+=Chartoint(Ins1.charAt(i))*Chartoint(Ins2.charAt(j)); s=Inttochar(A[0]/n)+\+Inttochar(A[0]%n)+s;//特别要注意+\ int pointlength=Dos1.length()+Dos2.length();//获取小数点后的位数 return Format(s.substring(0,s.length()-pointlength)+\+s.substring(s.length()-pointlength),true); } protected static String Division_Positive(String s1, String s2,int n,int f){//自定义两个正数相除(f为小数点后的位数,能被除尽,且小数点后的位数少于f,则直接返回结果); String Ins1=getInteger(s1),Dos1=getDecimal(s1),Ins2=getInteger(s2),Dos2=getDecimal(s2); //分别获取整数部分及小数部分 int Dolength=Math.max(Dos1.length(), Dos2.length()); Ins1+=AddToRight(Dos1,Dolength); Ins2+=AddToRight(Dos2,Dolength); String[]B=new String[n];B[0]=\; for(int i=1;i B[i]=Add_Positive(B[i-1],Ins2,n);//B[i]=Mult_Positive(Ins2,Inttochar(i)+\ } int i=Math.min(Ins1.length(), Ins2.length())-2,j; String Ds0=\,Ds1=Ins1.substring(0,i);//初始化整数部分余数部分 while(true){ } return Format(Ds0,true); if(i!=Ins1.length()){ } i++; if(i //下面开始求Ds1/Ins2的整数部分及余数,结果分别赋值为Ds0,Ds1;采用二分j=Binary(B,Ds1); Ds0+=Inttochar(j); Ds1=Sub_Positive(Ds1,B[j],n); Ds1+=Ins1.charAt(i); Ds1+=\; if(Ds1.equals(\)||i-Ins1.length()-1==f){ } break; }else{ 查找获取整数部分 }else{ Ds0+=\; } protected static int Binary(String[]A,String key){//二分查找key(数组A已经按从小到大的顺序排好序) int low=0,height=A.length-1,middle,Compare; while(low<=height){ } return height; middle=(low+height)/2; Compare=ComparetoString(key,A[middle]); if(Compare==0){ } return middle; low=middle+1; height=middle-1; }else if(Compare>0){ }else{ } public BigNumber Add(BigNumber b){//自定义加法运算 if(this.SystemNumber!=b.SystemNumber){ } String s; if(IsPositive(this.MyNumber)&&IsPositive(b.MyNumber)){ s=Sub_Positive(this.MyNumber,Opposite(b.MyNumber),this.SystemNumber); s=Add_Positive(this.MyNumber,b.MyNumber,this.SystemNumber); }else if(IsPositive(this.MyNumber)&&!IsPositive(b.MyNumber)){ throw (new NumberFormatException(\错误!这两个大数进制数不一致 (\+this.SystemNumber+\+b.SystemNumber+\)); }else if(!IsPositive(this.MyNumber)&&IsPositive(b.MyNumber)){ s=Sub_Positive(b.MyNumber,Opposite(this.MyNumber),this.SystemNumber); }else{ s=Add_Positive(Opposite(this.MyNumber),Opposite(b.MyNumber),this.System s=(s.equals(\)?\:\)+s; Number); } return new BigNumber(s,this.SystemNumber); } public BigNumber Sub(BigNumber b){//自定义减法运算 return this.Add(new BigNumber(Opposite(b.MyNumber),b.SystemNumber)); } public BigNumber Mult(BigNumber b){//自定义乘法运算 if(this.SystemNumber!=b.SystemNumber){ } String s; if(IsPositive(this.MyNumber)&&IsPositive(b.MyNumber)){ s=Mult_Positive(this.MyNumber,Opposite(b.MyNumber),this.SystemNumber); s=(s.equals(\)?\:\)+s; s=Mult_Positive(Opposite(this.MyNumber),b.MyNumber,this.SystemNumber); s=(s.equals(\)?\:\)+s; s=Mult_Positive(Opposite(this.MyNumber),Opposite(b.MyNumber),this.Syste mNumber); } return new BigNumber(s,this.SystemNumber); } public BigNumber Division(BigNumber b,int f){//自定义除法运算(f为小数点后的位数,能被除尽,且小数点后的位数少于f,则直接返回精确结果); if(b.toString().equals(\)||b.toString().equals(\)){ } if(this.SystemNumber!=b.SystemNumber){ } if(f<0){ } String s; if(IsPositive(this.MyNumber)&&IsPositive(b.MyNumber)){ s=Division_Positive(this.MyNumber,Opposite(b.MyNumber),this.SystemNumbe s=(s.equals(\)?\:\)+s; r,f); }else if(!IsPositive(this.MyNumber)&&IsPositive(b.MyNumber)){ s=Division_Positive(this.MyNumber,b.MyNumber,this.SystemNumber,f); }else if(IsPositive(this.MyNumber)&&!IsPositive(b.MyNumber)){ throw (new NumberFormatException(\错误!小数点后的位数应为非负 值!(\+f+\)); throw (new NumberFormatException(\错误!这两个大数进制数不一致! (\+this.SystemNumber+\+b.SystemNumber+\)); throw (new NumberFormatException(\错误!除数不能为零:\+b)); s=Mult_Positive(this.MyNumber,b.MyNumber,this.SystemNumber); }else if(IsPositive(this.MyNumber)&&!IsPositive(b.MyNumber)){ throw (new NumberFormatException(\错误!这两个大数进制数不一致 (\+this.SystemNumber+\+b.SystemNumber+\)); }else if(!IsPositive(this.MyNumber)&&IsPositive(b.MyNumber)){ }else{ s=Division_Positive(Opposite(this.MyNumber),b.MyNumber,this.SystemNumbe s=(s.equals(\)?\:\)+s; r,f); s=Division_Positive(Opposite(this.MyNumber),Opposite(b.MyNumber),this.S ystemNumber,f); } return new BigNumber(s,this.SystemNumber); } public BigNumber Division(BigNumber b){//自定义除法运算,默认为保留50位小数(若能被除尽,且小数点后的位数少于50,则直接返回精确结果); return Division(b,50); } protected static int ComparetoString(String s1,String s2){//判断两个正数的大小s1>s2返回1,s1=s2返回0,s1 Ins1=getInteger(s1),Dos1=getDecimal(s1),Ins2=getInteger(s2),Dos2=getDecimal(s2); int Dolength=Math.max(Dos1.length(), Dos2.length()); Ins1+=AddToRight(Dos1,Dolength); Ins2+=AddToRight(Dos2,Dolength); if(Ins1.length()>Ins2.length()){ } for(int i=0;i return 0; } public int Compareto(BigNumber b){ if(this.SystemNumber!=b.SystemNumber){ } String s1=Format(this.MyNumber,false),s2=Format(b.MyNumber,false); if(IsPositive(s1)&&IsPositive(s2)){ throw (new NumberFormatException(\错误!这两个大数进制数不一致 ,暂时无 法比较(\+this.SystemNumber+\+b.SystemNumber+\)); if(Ins1.charAt(i)>Ins2.charAt(i)){ } return 1; return -1; }else if(Ins1.charAt(i) }else if(Ins1.length() return ComparetoString(s1,s2);//int a=s1.CompareTo(s2); return a!=0?(a>0?1:-1):0; }else if(IsPositive(s1)&&!IsPositive(s2)){ } } protected static String Conver1(long n,int R){//将十进制数n转换为R进制数 if(R==10){ } String s=\; while(true){ } /* * 将R1进制正整数s转化为R2进制数 * (由于Conversion频繁调用该函数,为提高效率,引入两个辅助数组Hex1,Hex2): * Hex1[i]是十进制数i转换为R2进制数后的数,0<=i<=R1;Hex2[i]=Hex1[R1]^i,0<=i<=s.length() * Hex2[i]是十进制数R1转换为R2进制数后的i次方 */ protected static String Conver(String s,int R1,int R2,String[]Hex1,String[]Hex2){ Ins=Add_Positive(Ins,Mult_Positive(Hex1[Chartoint(s.charAt(s.length()-1 } return Ins; String Ins=\;//初始化新进制对应的大数 for(int i=0;i s=Inttochar((int)(n%R))+s; n/=R; if(n==0){ } return s; return n+\; return 1; return -1; return -ComparetoString(s1.substring(1),s2.substring(1)); }else if(!IsPositive(s1)&&IsPositive(s2)){ }else{ } -i))],Hex2[i],R2),R2); } protected static String Conversion(String MyNumber,int R1,int R2,int N,int f){//将R1进制大数MyNumber转换为R2进制的大数(f为小数点后的位数,能被除尽,且小数点后的位数少于f,则直接返回结果),N为将MyNumber分组后每组字符串的长度; if(R2==R1){ } int a=getDecimal(MyNumber).length()-f; if(a>0){ } return MyNumber; return MyNumber.substring(0,MyNumber.length()-a); if(MyNumber.charAt(0)=='+'||MyNumber.charAt(0)=='-'){ } String[]Hex1=new String[R1+1]; for(int i=0;i<=R1;i++){//将0~R1的所有数字转换为R2进制 } String[]Hex2=new String[N+1];Hex2[0]=\; for(int i=1;i<=N;i++){//求十进制数R1转换为R2进制数后的i次方 } Hex2[i]=Mult_Positive(Hex2[i-1],Hex1[R1],R2); Hex1[i]=Conver1(i,R2); char c=MyNumber.charAt(0); return c+Conversion(MyNumber.substring(1),R1,R2,N,f); String Ins1=getInteger(MyNumber),Dos1=getDecimal(MyNumber);//获取整数部分及小数部分 /* * 经过计算当转化后的R2进制数只需保留f位小数时,原R1进制数MyNumber只需 * 当MyNumber小数位很多,而f较小时在一定程度上能提高效率 */ int a=(int)Math.ceil(f*Math.log(R2)/Math.log(R1))+1; if(a<=Dos1.length()){ } Ins1=AddToLeft(Ins1,Ins1.length()+(N-Ins1.length()%N)%N);//扩充Ins1 Dos1=AddToRight(Dos1,Dos1.length()+(N-Dos1.length()%N)%N);//扩充Dos1 String Ins=\,Dos=\,x=\;//new Dos1=Dos1.substring(0,a); 保留a位 BigNumber(Conver1(R1,R2),R2).Power(N).MyNumber;初始化新进制对应的大数的整数部分及小数部分 ,设置初值及权 int Count=Math.max(Ins1.length()/N,Dos1.length()/N);//循环次数 for(int i=0,i1=Ins1.length()/N,i2=Dos1.length()/N;i if(i Ins=Add_Positive(Ins,Mult_Positive(Conver(Ins1.substring(Ins1.length()- } if(i (i+1)*N,Ins1.length()-i*N),R1,R2,Hex1,Hex2),x,R2),R2); Dos=Add_Positive(Dos,Mult_Positive(Conver(Dos1.substring(Dos1.length()- } return Ins+Dos.substring(1);//或Add_Positive(Ins,Dos,R2); } } x=Mult_Positive(x,Hex2[N],R2); if(i==i2-1){ Dos=Division_Positive(Dos,Mult_Positive(x,Hex2[N],R2),R2,f); (i+1)*N,Dos1.length()-i*N),R1,R2,Hex1,Hex2),x,R2),R2); } public BigNumber HexConversion(int R,int N,int f){ if(R<=1||R>=63){//进制数不合法 throw (new NumberFormatException(\错误!进制数不合法 \+this.SystemNumber)); } if(N<=0){ } if(f<0){ } return new BigNumber(Conversion(this.MyNumber,this.SystemNumber,R,N,f),R); } public BigNumber HexConversion(int R,int f){ int N=(int)Math.pow(Math.max(getInteger(this.MyNumber).length(),getDecimal(this.MyNumber).length()),0.6)+1; return HexConversion(R,N,f); } public BigNumber HexConversion(int R){ return HexConversion(R,50); } public BigNumber Power(int n,int f){//求a^n,n为十进制整数(f为小数点后的位数,能被除尽,且小数点后的位数少于f,则直接返回结果); if(n<0){ } return new BigNumber(\,this.SystemNumber).Division(this.Power(-n,f),f); throw (new NumberFormatException(\错误!小数点后的位数应为非负 值!(\+f+\)); throw (new NumberFormatException(\错误!每小组的字符串长度不能小于 1!(\+N+\)); String s=Conver1(n,2); BigNumber r=new BigNumber(\,this.SystemNumber),k=this; if(s.charAt(s.length()-1-i)=='1'){ } k=k.Mult(k); r=r.Mult(k); for(int i=0;i public BigNumber Power(int n){//求a^b,b为十进制整数 return Power(n,50); } protected static BigNumber getComplement(BigNumber b){//获得 b的每位取反后的大数 String s=\; char c=b.MyNumber.charAt(0); if(c=='+'||c=='-'||c=='.'){ } for(int i=1;i return new BigNumber(s,b.SystemNumber); } protected static String AddToLeft(String s,int length){//若s的长度大于或等于length,则直接返回s,否则字符串s左边补零,直到s长度达到length if(s.length()>=length){ } while(s.length() return s.substring(s.length()-length,s.length()); } protected static String AddToRight(String s,int length){//若s的长度大于或 return s; c=b.MyNumber.charAt(i); if(c=='.'){ } s+=c; s+=Inttochar(b.SystemNumber-1-Chartoint(c)); }else{ s+=c; s+=Inttochar(b.SystemNumber-1-Chartoint(c)); }else{ return r; 等于length,则直接返回s,否则字符串s右边补零,直到s长度达到length if(s.length()>=length){ } while(s.length() return s.substring(0,length); } protected static String Format(String MyNumber,boolean DealZero){//对于合法的大数,格式化大数为a.b(或-a.b)的形式,若b=0且DealZero为真则返回a(或-a)的形式 new BigNumber(MyNumber,62);//若该大数不合法则抛出异常 String s; s=MyNumber.substring(1); s=MyNumber; if(MyNumber.charAt(0)=='+'||MyNumber.charAt(0)=='-'){ } if(getPointPlace(s)==0){ } int Ins=0,Dos=s.length(),pointplace=getPointPlace(s); for(int i=0;i if(s.charAt(i)=='0'){ } Ins++; break; }else{ s=\+s; s=s+\; s=s+\; }else if(getPointPlace(s)==s.length()-1){ }else if(getPointPlace(s)==s.length()){ }else{ return s; } for(int i=s.length()-1;i>pointplace+1;i--){ if(s.charAt(i)=='0'){ } s=(MyNumber.charAt(0)=='-'?\:\)+s.substring(Ins,Dos); if(DealZero&&s.substring(s.length()-2).equals(\)){ return s.substring(0,s.length()-2); }else{ Dos--; break; }else{ } } return s; } protected static boolean IsPositive(String MyNumber){//判断该大数是否为正数(负数返回false,0和正数返回true) if(MyNumber.charAt(0)=='-'){ } return true; } protected static int getPointPlace(String MyNumber){//返回该大数小数点位置 for(int i=0;i return MyNumber.length(); } protected static String Abs(String MyNumber){//返回该大数的绝对值 MyNumber=Format(MyNumber,true); return MyNumber.substring(MyNumber.charAt(0)=='-'?1:0); } protected static String Opposite(String MyNumber){//返回该大数的相反数 return MyNumber.charAt(0)=='-'?Abs(MyNumber):\+Abs(MyNumber); } protected static String getInteger(String MyNumber){//返回该大数的整数部分 MyNumber=Format(MyNumber,false); return MyNumber.substring(0,getPointPlace(MyNumber)); } protected static String getDecimal(String MyNumber){//返回该大数的小数部分 MyNumber=Format(MyNumber,false); String s=getPointPlace(MyNumber)==MyNumber.length()?\:MyNumber.substring(getPointPlace(MyNumber)+1); return (MyNumber.charAt(0)=='-'?\:\)+s; } if(c>='0'&&c<='9'){ return c-'0'; return c-'A'+10; }else if(c>='A'&&c<='Z'){ }else if(c>='a'&&c<='z'){ protected static int Chartoint(char c){//字符化为数字 if(MyNumber.charAt(i)=='.'){ } return i; return false; } } } } return c-'a'+36; return -1; return -2; return -3; return -4; }else if(c=='+'){//正号 }else if(c=='-'){//负号 }else if(c=='.'){//小数点 }else{//其他 protected static char Inttochar(int n){//数字化为字符 if(n>=0&&n<=9){//0~9用0~9表示 } return (char)(n+48); return (char)(n+55); return (char)(n+61); return '~'; }else if(n>=10&&n<=35){//10~35用A~Z表示 }else if(n>=36&&n<=61){//36~61用a~z表示 }else{//小于0或大于61的数用'~'表示 public String toString(){ } return Format(this.MyNumber,true); 顺便写了个测试类,限于篇幅这里只测试进制转换的效果与效率 测试类: TestBigNumber.java public class TestBigNumber { public static void main(String[]args){ String MyNumber=\DRG424242ADAFFGDRG142356679707464342424242ADAFSFGDRG67866679707464342424242ADAFSFGDRG96068563556667970746V6679707464342424423536858686242ADAFSFGD69979RG67970746434242427979742ADAFS.FGDRG646676679707464342424242ADAFSFGDRG9707464342424242ADAFSFGDRG342424242ADAFSFGDRG67970746434266797074643426679707464342424242ADAFSFGDRG424242ADAFSFGDRG424242ADAFSFGDRG242423424266797074643424 24242ADAFSFGDRG534364547455686679707464342424242ADAFSFGDRG6679707464342424242ADAFSFGDRGDADA6679707464342424242ADAFSFGDRGAFSFS6679707464342424242ADAFSFGDRG\; } int R1=39,R2=62,R3=2; int f=100; BigNumber b=new BigNumber(MyNumber,R1); } long c1=System.currentTimeMillis(); System.out.println(\将\+R1+\进制数\+MyNumber+\转化为\+R2+\进制数并保留long c2=System.currentTimeMillis(); System.out.println(\将\+R1+\进制数\+MyNumber+\转化为\+R3+\进制数并保留long c3=System.currentTimeMillis(); System.out.println(\两次转换分别耗时为 \+(c2-c1)+\+(c3-c2)+\); \+f+\位小数后去除无效位的结果为:\+b.HexConversion(R2, f)); \+f+\位小数后去除无效位的结果为:\+b.HexConversion(R3, f)); 测试结果: 将39进制数 1313624242ADAFSFGDRG424242ADAF679707464342424242ADAFS24242ADAFSFGDRG424242ADAFFGDRG142356679707464342424242ADAFSFGDRG67866679707464342424242ADAFSFGDRG96068563556667970746V6679707464342424423536858686242ADAFSFGD69979RG67970746434242427979742ADAFS.FGDRG646676679707464342424242ADAFSFGDRG9707464342424242ADAFSFGDRG342424242ADAFSFGDRG67970746434266797074643426679707464342424242ADAFSFGDRG424242ADAFSFGDRG424242ADAFSFGDRG24242342426679707464342424242ADAFSFGDRG534364547455686679707464342424242ADAFSFGDRG6679707464342424242ADAFSFGDRGDADA6679707464342424242ADAFSFGDRGAFSFS6679707464342424242ADAFSFGDRG转化为62进制数并保留100位小数后去除无效位的结果 为:CSicxuSbDy6b15mLRWpdQ03beazrJG5zcEBpMTZ7oxowiNnCN2V2M9xDYHbAF9g6yYEPhEPyQi1Jki1eamKZv9ceksCKkZzNjHDFv7wnmlCJSPVJtkFovcB65NUUYnHyMRYOMrt7wpQg1cy9UFqoVJOg6uicQZDDxdsxW7OdFtG60YEkAx3uuL6izr87hebmroc4ZHum8izmVRxylA1mARwFa.OVmjfCSTpwpEPSYDMTLpzKxV1LWaoEOdZV8Q5Ie2y8XeUDJ5M5Yh4QksANCxWcYlDW1v3XpvZ5AXC7XLlR5uyHK63kwPWpwJhLh6 将39进制数 1313624242ADAFSFGDRG424242ADAF679707464342424242ADAFS24242ADAFSFGDRG424242ADAFFGDRG142356679707464342424242ADAFSFGDRG67866679707464342424242ADAFSFGDRG96068563556667970746V6679707464342424423536858686242ADAFSFGD69979RG67970746434242427979742ADAFS.FGDRG646676679707464342424242ADAFSFGDRG9707464342424242ADAFSFGDRG342424242ADAFSFGDRG67970746434266797074643426679707464342424242ADAFSFGDRG424242ADAFSFGDRG424242ADAFSFGDRG24242342426679707464342424242ADAFSFGDRG534364547455686679707464342424242ADAFSFGDRG6679707464342424242ADAFSFGD RGDADA6679707464342424242ADAFSFGDRGAFSFS6679707464342424242ADAFSFGDRG转化为2进制数并保留100位小数后去除无效位的结果 为:110101101010110010111000101001101101000100001111010000100111110011011011000111010010000001100101000011100001001100010000111001010100011011101110010111011001011101001110011110100011101010100110111001010011011110011001011111001111000010010000010101110100010010000011111111011100010001110111111111111101110000110010001001110100100001010111100110001101110001001011110000101011000010100110100101111000110111111100110010101111111101011100110100100100101111011010001111001111111010101100100010110100001100101010111101010110100101000100110100011110001011000011110011001010001110000001001101110011011001011100110101011011101110000011010100001011100101111001000110110111010010100101100101011110101010001101100010000000000111100110010111011110010101011011001111100110000100010000011001011110101111001001001011111110110110110110101011100101100011111011011010100001000100100101010100111100111110110001010001000011001011000111111101100111011011110110001101101010000100101000110010100000110011111100001001101000000010101000000010110000001000101111001111111100010100000111110010010100000110011100100111001010001101010111010110100100011011000011100001001100110010010100110001010001011110101111100111110110000001111101110011100110101101101101011110010111100001001000001110100100000001011111100010101110110110.01100101001101101011000100100111011011111011010111111011111001001101110101111100000110010100011011 两次转换分别耗时为 407ms,312ms RGDADA6679707464342424242ADAFSFGDRGAFSFS6679707464342424242ADAFSFGDRG转化为2进制数并保留100位小数后去除无效位的结果 为:110101101010110010111000101001101101000100001111010000100111110011011011000111010010000001100101000011100001001100010000111001010100011011101110010111011001011101001110011110100011101010100110111001010011011110011001011111001111000010010000010101110100010010000011111111011100010001110111111111111101110000110010001001110100100001010111100110001101110001001011110000101011000010100110100101111000110111111100110010101111111101011100110100100100101111011010001111001111111010101100100010110100001100101010111101010110100101000100110100011110001011000011110011001010001110000001001101110011011001011100110101011011101110000011010100001011100101111001000110110111010010100101100101011110101010001101100010000000000111100110010111011110010101011011001111100110000100010000011001011110101111001001001011111110110110110110101011100101100011111011011010100001000100100101010100111100111110110001010001000011001011000111111101100111011011110110001101101010000100101000110010100000110011111100001001101000000010101000000010110000001000101111001111111100010100000111110010010100000110011100100111001010001101010111010110100100011011000011100001001100110010010100110001010001011110101111100111110110000001111101110011100110101101101101011110010111100001001000001110100100000001011111100010101110110110.01100101001101101011000100100111011011111011010111111011111001001101110101111100000110010100011011 两次转换分别耗时为 407ms,312ms
正在阅读:
java自定义大数(进制可在2-62之间相互转换)12-01
第二章 - 连续系统的时域分析12-08
学校教育教学改革实施方案(小学)04-27
禁止教师乱办班承诺书精选03-20
小学语文:第二单元《识字与写字》教学设计(语文S版二年级下)01-31
2022年4月陕西省汉中市2022届高三教学质量第二次检测考试英语试04-17
微电影的相关文章推荐02-14
有趣的跳蚤市场作文600字07-08
供应链管理习题库及参考答案(1)汇总10-16
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- 大数
- 进制
- 可在
- 相互
- 定义
- 转换
- 之间
- java
- 62
- 区经济运行协调领导小组及其办公室工作规程
- 中国奶业协会乳品工业专业委员会人员名单及工作职能
- 汽轮机原理习题(作业题答案)
- 2011年宣州区生活饮用水卫生监督检查工作总结
- 完全成本法与变动成本法的比较及其结合应用问题(1)
- ESFP - 10了解自己:MBTI性格测试
- 2019年江苏省盐城市中考语文试题(word版,含答案)
- 2018届中考数学全程演练含答案:第42课时 阅读理解型问题
- 四年级下语文教材解读-人类的老师-苏教版
- 年产68万吨焦化厂硫铵工段的初步设计
- “蓓蕾读书工程”推荐阅读篇目
- 学前游戏同步练习
- 粤教版语文必修2 第二单元第5课知能优化演练
- 《城镇燃气设计规范》GB50028-2006题库
- 工商局十二五工作汇报
- 化工自控设计规定阅读笔记
- 修改完 防水方案
- 课程名称翻译汇总
- 抗浮锚杆全流程施工易出现地问题及整改要求措施 - 图文
- 奥赛起跑线(上)六年级