> For the complete documentation index, see [llms.txt](https://docs.cheddar.vihan.org/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cheddar.vihan.org/docs/literals/number.md).

# Number

Numbers are a way to represent any ordinal limited by your computer's memory.

Cheddar's numbers support **decimals**, **separators**, **bases**, and **implicit promotion**.

## Basic Numbers

The most basic form of a number in Cheddar are integers and decimals. Cheddar wraps both of these in a "Number" type. You can write numbers as you would in most languages:

```c
1
123
123.456
.123
0.1
1.0
```

## Separators

Often in programs you deal with large numbers. Numbers are often written with commas to distinguish the sections of the number. Cheddar provides a simple **syntax for number separators**, `_`.

```swift
 123_456 // Same as 123456
 1_2_3_4 // Same as 1234
 1__2345 // same as 12345
```

As you can see, Cheddar does not enforce where you place your number separators.

## Bases

You can type **binary**, **octal**, and **hexadecimal** literals in Cheddar:

```javascript
 0b1010   // *b*inary
 0xFF     // He*x*adecimal
 0o0222   // *o*ctal
```

What's the zero at the beginning? That specified the amount of **zeros to append** to the integer section of the number. For example:

```java
 2b1 // equal to 0b100
 1xF // equal to 0xF0
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cheddar.vihan.org/docs/literals/number.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
