aardio 文档

math.bignum 库模块帮助文档

说明

此扩展库基于开源项目 tiny-bignum-c https://github.com/kokke/tiny-bignum-c

math 成员列表 #

math.bignum() #

创建大数对象
参数可以使用 10 进制或 16 进制的字符串指定数值,16进制必须有0x前缀,
也可以是普通整数,或者 math.size64 函数创建的长整数,
传入math.bignum对象则复制为新的大数对象

返回对象:mathbignumObject

math.bignum 成员列表 #

大数对象,仅支持正整数,不支持负数或小数。
大数对象可以使用 tostring 函数转换为普通字符串
并可以在 tostring 的第二个参数中指定显示进制,默认输出 10 进制数。

math.bignum.is() #

参数 @1 是否 math.bignum 对象。

mathbignumObject 成员列表 #

mathbignumObject.add() #

加运算,
参数可以是普通整数,也可以是大数对象
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.and() #

位与,
参数是普通整数
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.dec() #

自减,
参数可以是普通整数,也可以是大数对象
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.div() #

除运算,
参数可以是普通整数,也可以是大数对象
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.fromString() #

自16进制字符串获取数值更新并返回自身

mathbignumObject.inc() #

自增,
参数可以是普通整数,也可以是大数对象
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.isZero() #

数值是否为0

mathbignumObject.isqrt() #

整数平方根,
参数可以是普通整数,也可以是大数对象
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.lshift() #

位左移,
参数是普通整数
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.mod() #

模运算,
参数可以是普通整数,也可以是大数对象
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.mul() #

乘运算,
参数可以是普通整数,也可以是大数对象
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.or() #

位或,
参数是普通整数
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.pow() #

乘方,
参数可以是普通整数,也可以是大数对象
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.random() #

生成指定长度的随机数值更新并返回自身

mathbignumObject.rshift() #

位右移,
参数是普通整数
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.size64() #

返回size64对象

mathbignumObject.sub() #

减运算,
参数可以是普通整数,也可以是大数对象
返回新的大数对象

返回对象:mathbignumObject

mathbignumObject.xor() #

位异或,
参数是普通整数
返回新的大数对象

返回对象:mathbignumObject

Markdown 格式