超大数计算
2023-01-24 09:16:15 最后更新
fn math.加法("9223372036854775808","9223372036854775807")
fn math.减法(sss.返回,"9223372036854775807")
tw(sss.返回)
//以下代码放 math.myu
//作者残页,QQ1582270018
//哪个不对就反馈给我
//以下函数传入2个大数的字符串表示形式,返回一个结果的字符串表示形式
fn 加法(a,b)
javanew(a,"java.math.BigInteger","String",a)
javanew(b,"java.math.BigInteger","String",b)
java(c,a,"java.math.BigInteger.add","java.math.BigInteger",b)
java(sss.返回,c,"java.math.BigInteger.toString")
end fn
fn 减法(a,b)
javanew(a,"java.math.BigInteger","String",a)
javanew(b,"java.math.BigInteger","String",b)
java(c,a,"java.math.BigInteger.subtract","java.math.BigInteger",b)
java(sss.返回,c,"java.math.BigInteger.toString")
end fn
fn 乘法(a,b)
javanew(a,"java.math.BigInteger","String",a)
javanew(b,"java.math.BigInteger","String",b)
java(c,a,"java.math.BigInteger.multiply","java.math.BigInteger",b)
java(sss.返回,c,"java.math.BigInteger.toString")
end fn
fn 除法(a,b)
javanew(a,"java.math.BigInteger","String",a)
javanew(b,"java.math.BigInteger","String",b)
java(c,a,"java.math.BigInteger.divide","java.math.BigInteger",b)
java(sss.返回,c,"java.math.BigInteger.toString")
end fn
fn 异或(a,b)
javanew(a,"java.math.BigInteger","String",a)
javanew(b,"java.math.BigInteger","String",b)
java(c,a,"java.math.BigInteger.xor","java.math.BigInteger",b)
java(sss.返回,c,"java.math.BigInteger.toString")
end fn
//以下函数传入1个大数的字符串表示形式,1个移位值的int表示形式,返回一个结果的字符串表示形式
fn 位左移(a,b)
javanew(a,"java.math.BigInteger","String",a)
java(c,a,"java.math.BigInteger.shiftLeft","int",b)
java(sss.返回,c,"java.math.BigInteger.toString")
end fn
fn 位右移(a,b)
javanew(a,"java.math.BigInteger","String",a)
java(c,a,"java.math.BigInteger.shiftRight","int",b)
java(sss.返回,c,"java.math.BigInteger.toString")
end fn
iApp一本通