Эта страница является
переводом страницы
CreateBigIntContext. Перевод выполнен на 100%.
IR.CreateBigIntContext()
Method to create a large number.
Syntax
IR.CreateBigIntContext(bool)
| bool
|
false
|
type: Boolean format of a number: true - number in hex format; false - number in decimal format.
|
| result
|
11111111111111...
|
type: number large number.
|
Sample
var DBigNum = IR.CreateBigIntContext(false)
var DValue1 = "11111111111111111111111111111111111111111111111111111111"
var DValue2 = "11111111111111111111111111111111111111111111111111111111"
IR.Log(DBigNum.Add(DValue1, DValue2))
Futher on you'll find description of methods that can be used with large numbers.
.Add
Addition of large numbers (r = a + b).
Syntax
HBigNum.Add(a, b)
| HBigNum
|
IR.CreateBigIntContext(true)
|
type: object pointer to a large number.
|
| r
|
1E
|
type: number result of addition of large numbers.
|
Sample
var HBigNum = IR.CreateBigIntContext(true)
IR.Log(HBigNum.Add("F", "F"))
.Exp
Exponent (r = a ^ p).
Syntax
HBigNum.Exp(a, b)
| HBigNum
|
IR.CreateBigIntContext(true)
|
type: object pointer to a large number.
|
| r
|
03E8
|
type: number result of exponentation.
|
Sample
var HBigNum = IR.CreateBigIntContext(true)
IR.Log(HBigNum.Exp("A", "3"))
.ModExp
Getting the remainder of an exponential number divided by m (r = a ^ p % m).
Syntax
HBigNum.ModExp(a, p, m)
| HBigNum
|
IR.CreateBigIntContext(true)
|
type: object pointer to a large number.
|
| r
|
08
|
type: number result of exponential operation and getting the remainder from dividing large numbers.
|
Sample
var HBigNum = IR.CreateBigIntContext(true)
IR.Log(HBigNum.ModExp("2", "3", "A"))
.Sub
Substraction of large numbers (r = a - b).
Syntax
HBigNum.Sub(a, b)
| HBigNum
|
IR.CreateBigIntContext(true)
|
type: object pointer to a large number.
|
| r
|
F5
|
type: number result of substracting large numbers.
|
Sample
var HBigNum = IR.CreateBigIntContext(true)
IR.Log(HBigNum.Sub("FF", "A"))
.Mul
Multiplication oof large numbers (r = a * b).
Syntax
HBigNum.Mul(a, b)
| HBigNum
|
IR.CreateBigIntContext(true)
|
type: object pointer to a large number.
|
| r
|
D2
|
type: number result of substraction of large numbers.
|
Sample
var HBigNum = IR.CreateBigIntContext(true)
IR.Log(HBigNum.Mul("F", "E"))
.Sqr
Squaring large numbers (r = a ^ 2).
Syntax
HBigNum.Sqr(a)
| HBigNum
|
IR.CreateBigIntContext(true)
|
type: object pointer to a large number.
|
| r
|
64
|
type: number result of squaring large numbers.
|
Sample
var HBigNum = IR.CreateBigIntContext(true)
IR.Log(HBigNum.Sqr("A"))
.Gcd
Calculation of the greater common divisor (r = (a, b)).
Syntax
HBigNum.Gcd(a, b)
| HBigNum
|
IR.CreateBigIntContext(true)
|
type: object pointer to a large number.
|
| r
|
05
|
type: number the greater common divisor of a and b.
|
Sample
var HBigNum = IR.CreateBigIntContext(true)
IR.Log(HBigNum.Gcd("FF", "AF"))
.Div
Wholenumber division of large numbers (r = a / b).
Syntax
HBigNum.Div(a, b)
| HBigNum
|
IR.CreateBigIntContext(true)
|
type: object pointer to a large number.
|
| r
|
0199
|
type: number result of wholenumber division.
|
Sample
var HBigNum = IR.CreateBigIntContext(true)
IR.Log(HBigNum.Gcd("FFF", "A"))
.HexToDec
Conversion of a hex number into a decimal one.
Syntax
HBigNum.HexToDec(a)
| HBigNum
|
IR.CreateBigIntContext(true)
|
type: object pointer to a large number.
|
| a
|
"C"
|
type: number number in the hex system.
|
| result
|
12
|
type: number result of number conversion into a decimal one.
|
Sample
var HBigNum = IR.CreateBigIntContext(true)
IR.Log(HBigNum.HexToDec("С"))
.DecToHex
Conversion of a large decimal number into a hex one.
Syntax
HBigNum.DecToHex(a)
| HBigNum
|
IR.CreateBigIntContext(true)
|
type: object pointer to a large number.
|
| a
|
"10"
|
type: number number in the decimal system.
|
| result
|
0A
|
type: number result of number conversion into a hex one.
|
Sample
var HBigNum = IR.CreateBigIntContext(true)
IR.Log(HBigNum.DecToHex("10")) // result: 0A