# Numbers - Manhunter07/MFL GitHub Wiki

Numbers are numeric integer or real values that support arithmetic operations. They are floating-point values with an extended precision whose value range is represented by the constants MinValue and MaxValue. Numbers support three ways of notation: *Decimal*, *scientific* and *hexadecimal*, see below for a detailed overview and explaination.

## Decimals

Decimals use the standard numeric notation, common in most programming languages. They start with a digit from `0`

to `9`

and may contain a dot separating the integer from the fractional part. Decimals may also use the *scientific notation* with a ten's exponent. The following code demonstrates how decimal numbers can be used:

```
121 \represents 121.0\
5.79 \represents 5.79\
28. \represents 28.0 as trailing zeros in fractional parts are optional\
8e2 \represents 800.0\
2.61e-4 \represents 0.000261\
```

## Hexadecimals

Hexadecimals are numbers to the base 16. Like most common languges, MFL supports their notation using a special indicator. They are prepended by a dollar sign (`$`

), similar to Pascal. Hexadecimals in MFL follow the same syntax and limitations as those in Pascal, including **not** supporting fractional parts or the scientific notation. They contain a number of digits from `0`

to `9`

and from `a`

to `f`

. Char casing is ignored, but the convention recommends the use of lowercase numbers. Just like normal decimal numbers, hexadecimals are internally stored as floating-point numbers with no special treatment. To convert an integer number back to its hexadecimal string representation, use the `Hex`

function from the `System`

package.

## Types

See also:Numeric types

There are different numeric types available to be used as type constraints for function parameters or for different purposes. The most generic one is `Number`

, supporting any numeric values including the special values of `NaN`

and `Inf`

. There are also different numneric type constructors available, including `integer`

, `rangeint`

and `sizeint`

. Other more generic type constructors like `range`

or `enum`

can be used with numeric arguments, too.

## Operators

### Type check

Like any other data type, numbers support the type compatibility check operator (`?:`

). It returns `True`

on `Number`

, but also any other type that supports the respected value(s).