REBOL 3 Datatypes: Integer!
Contents
Concept
In R3 the integer! datatype has been expanded to be a 64-bit value.

It ranges from:

Minimum: -9223372036854775808
Maximum: 9223372036854775807
Format
Integer values consist of a sequence of numeric digits. A plus (+) or minus (-) immediately before the first digit indicates sign. (There cannot be a space between the sign and the first digit.) Leading zeros are ignored.

0 1234 +1234 -1234 00012 -0123
Do not use commas or periods in integers. If a comma or period is found within an integer it is interpreted as a decimal value. However, you can use a single quote (`) to separate the digits in long integers. Single quotes can appear anywhere after the first digit in the number, but not before the first digit.

2'147'483'647
Conversion
Use the to function can convert a string! , logic! , decimal! , or integer! datatype to an integer:

to integer! "123"
123
to integer! false
0
to integer! true
1
Conversion from decimal! will be truncated towards zero:

to integer! 123.8
123
to integer! -123.8
-123
Use the round function if you desire some other behavior.

To convert a binary! to an integer! value:

to integer! #{1000}
4096
Note that the conversion treats the string in network-byte-order (big-endian) and it is not sign extended:

to integer! #{8000}
32768
To convert from an integer! to a binary! (in network-byte-order):

to binary! 32768
#{0000000000008000}
Note that the full hex bit pattern (8 bytes) is output.

As expected, negative values will set the first bit:

to binary! -1
#{FFFFFFFFFFFFFFFF}
As a convenience for HTML color values, conversions from issue! values are also allowed:

to integer! #8855DD
8934877
Note that to obtain the individual RGB color values, you might want to use a tuple! value instead:

rgb: to tuple! #8855DD
136.85.221
rgb/2
85
Special Note
Note that for RGB values the above hex conversion is not reversible. That's because the intended use of the integer is not known (to be an RGB value.)

However, you can define your own function for this conversion:

to-rgb-str: func [n] [take/last/part to-hex n 6]
This method is preferred because it does not depend on the zero padding at the head of the string, making it work for 32-bit versions of REBOL as well.

Here's an example:

to-rgb-str to integer! #A8446C
#A8446C
Type Coercion
If a decimal and integer are combined in an expression, the integer is converted to a decimal:

1.2 + 2
3.2
2 + 1.2
3.2
1.01 > 1
true
0 < .001
true
Related
Use integer? to determine whether a value is an integer! datatype.

integer? -1234
true
Use the form , print , and mold functions with an integer argument to print a integer value as a string:

mold 123
123
form 123
123
print 123
123