# Basic Types

Frost provides a robust set of primitive types designed for systems programming, offering both safety and performance.

## Numeric Types

### Int (Integer)

The standard integer type in Frost represents whole numbers:

```frost
age: int = 20
```

**Properties**

* Size: 32 bits (4 bytes)
* Range: -2,147,483,648 to 2,147,483,647
* Default value: 0

### Float (Single-precision)

{% hint style="info" %}
Floats in Frost have some quirks.

One quirk of Frost is the use of commas (`,`) instead of periods for floating-point numbers.

Another one, is that floating-point numbers are treated as `double` unless explicitly marked as `float`. This can be done either by appending an `f` to the number or by using the `cast` expression:

```frost
temperature: float = 23,5f
```

{% endhint %}

32-bit floating-point numbers following IEEE 754:

```frost
pi: float = @float(3,14159265359)
```

**Properties**

* Size: 32 bits (4 bytes)
* Precision: \~7 decimal digits
* Range: ±3.4E±38

### Double (Double-precision)

{% hint style="info" %}
Similar to `float`, `double` have a suffix `d` to differentiate them from `float`

```frost
temperature: double = 23,5d
```

{% endhint %}

64-bit floating-point numbers for higher precision calculations:

```frost
pi: double = 3,14159265359
```

**Properties**

* Size: 64 bits (8 bytes)
* Precision: \~15-17 decimal digits
* Range: ±1.7E±308

## Character Types

### Char

Represents a single Unicode character:

```frost
letter: char = 'A'
newline: byte = '\n'     % Escape sequences
hex: int8 = '\x20'       % Hexadecimal
```

**Properties**

* Size: 8 bits (1 byte)
* Encoding: UTF-8
* Default value: '\0'

## Boolean Type

### Boolean

Represents logical true/false values:

```frost
is_valid: bool = true
has_error: bool = false

result: bool = is_valid and not has_error
```

**Properties**

* Size: 1 byte
* Values: true, false
* Default value: false

## Special Types

### Never

Represents the absence of a type, commonly used in functions that don't return values:

```frost
no_op: never -> never = {
    % Do nothing
}
```

## Type Conversion

Frost provides safe type conversion mechanisms:

```frost
% Explicit type casting
x: int = 42
y: double = @double(x)  % Convert 'x' to double

% Numeric promotion
a: int = 5
b: double = 2,5

result: double = a + b  % 'a' is automatically promoted to double
```

## Memory Alignment

Types are automatically aligned for optimal performance:

```frost
example :: struct {
    c -> char,    % 1 byte
    i -> int,     % 8 bytes
    f -> float    % 4 bytes
}
% Struct will be properly padded for alignment
```

Remember that Frost's type system is designed to prevent common programming errors while maintaining performance. The compiler performs extensive type checking at compile-time to ensure type safety in your programs.


---

# Agent Instructions: 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://frost-lang.gitbook.io/frost/user-manual/syntax/basic-types.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.
