# TODO: revert to cue eval -i post fix for #1786
! exec cue eval numbers.cue
cmp stderr expect-stderr

-- frontmatter.toml --
title = "Numbers"
description = ""

-- text.md --
CUE defines two kinds of numbers.
Integers, denoted `int`, are whole, or integral, numbers.
Floats, denoted `float`, are decimal floating point numbers.

An integer literal (e.g. `4`) can be of either type, but defaults to `int`.
A floating point literal (e.g. `4.0`) is only compatible with `float`.

In the example, the result of `b` is a `float` and cannot be
used as an `int` without conversion.

CUE also adds a variety of sugar for writing numbers.

-- numbers.cue --
a: int
a: 4 // type int

b: number
b: 4.0 // type float

c: int
c: 4.0

d: 4  // will evaluate to type int (default)

e: [
    1_234,       // 1234
    5M,          // 5_000_000
    1.5Gi,       // 1_610_612_736
    0x1000_0000, // 268_435_456
]

-- expect-stderr --
c: conflicting values int and 4.0 (mismatched types int and float):
    ./numbers.cue:7:4
    ./numbers.cue:8:4
