summaryrefslogtreecommitdiffstats
path: root/source/rainerscript/functions/rs-int2hex.rst
blob: 29cbbdd1247d38a887fee68e788f8e39ce2dd8c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
*********
int2hex()
*********

Purpose
=======

int2hex(num)

Returns a hexadecimal number string of a given positive integer num.

.. note::

   When a negative integer is given the return value will be the
   `Two's complement <https://en.wikipedia.org/wiki/Two%27s_complement>`_ of
   the input number.


Example
=======


Positive Integer given
----------------------

In the following example the hexadecimal number of 61 is returned
as a string.

.. code-block:: none

   int2hex(61)

produces

.. code-block:: none

   3d


Negative Integer given
----------------------

This example shows the result on a 64-bit system when a negative
integer such as -13 is put into the function.

.. code-block:: none

   int2hex(-13)

produces

.. code-block:: none

   fffffffffffffff3