© Tyl Software Foundation 2019-2021
▶ BIG NUMBERS
For most applications, integral (whole) numbers are in the range
{ -1000, 1000 }. But what happens when greater numbers are needed to be handled?
Tyl gives you the ability to handle any integral values, and supports all arithmetic calculations with them. Moreover, Tyl actually abstracts any indication of a number as being a big number, therefore enabling the programmer to write the same code as written for regular numbers.
Let's assign the number 100000000001 to a variable:
Tyl gives you the ability to handle any integral values, and supports all arithmetic calculations with them. Moreover, Tyl actually abstracts any indication of a number as being a big number, therefore enabling the programmer to write the same code as written for regular numbers.
Let's assign the number 100000000001 to a variable:
bigint 100000000001
print bigint
100000000001
As in numbers page, the big number 100000000001 is
declared and assigned to
Likewise, all other operations and instructions in numbers page, are valid here.
Example of big numbers program:
bigint
variable.
Likewise, all other operations and instructions in numbers page, are valid here.
Example of big numbers program:
num 1
index 20 ~ print newline + num ** 9999
9999
99980001
999700029999
9996000599960001
99950009999000049999
999400149980001499940001
9993002099650034997900069999
99920027994400699944002799920001
999100359916012598740083996400089999
9990004498800209974802099880004499900001
99890054983503299538046196700164994500109999
998800659780049492080923920804949780006599880001
9987007797140714871317158284128692850285992200129999
99860090963610007998300265683002799810009636009099860001
998501049545136469975004356564344995300286350454989500149999
9984011994401819563280068561286885608007563218199440011999840001
99830135932023793813237405544307569194467624618776200679986400169999
998201529184305914338560818037531384375481778563143230599184015299820001
9981017090313874837471269619557276312370442303852869162761240968982900189999
99800189886048434499875224925953205847392052596224838758449648448860018999800001
To make the distinction between real numbers and
big numbers, consider this:
realnum math.power 10 15
bigint 100000 * 100000 * 100000
print realnum
print bigint
print realnum - bigint
1E+15
1000000000000000
0
1000000000000000
0
Big real number is printed with 'E+' notation, while big number is
printed in an "as is" manner. Last subtraction shows that their value is the
same.