DGS Studio

Number Systems

Decimal to Hexadecimal

Convert a decimal integer to hexadecimal.

hex(255) converts 255. 255 = 15·16 + 15, and 15 is the digit F, so the result is 0xFF.

Prefixes select the base before any arithmetic happens. A digit that does not belong in that base is an error. In this workflow a caret would mean XOR. The decimal value is shown beside the prefixed result when both are meaningful.

Equation

hex(255)

How the base is chosen

Number-system examples treat a prefixed token as an integer in a base. 0b is binary, 0o is octal, and 0x is hexadecimal. Inside one of these expressions, a caret is bitwise XOR, not a power. AND, OR, XOR, and shifts act on the bits after the values are converted.

DGS checks the digits before it converts, so a digit that does not exist in that base is an error rather than a silent change. A result can show both the prefixed form and the decimal value. The walk-through on this page uses the same place values.

Reading the input

Try a change

Solve Equation opens the original input in the equation workspace and displays its symbolic results, conditions, and solution steps.

Edit and generate

Solve Equation opens the studio homepage and runs this field. Open in DGS Studio loads the same text and waits for you to generate it. The equation is sent once, as a query parameter.

Related examples