1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
## std.numbers: Operations on numbers and such.
## A stub module for documentation. Mostly compiler magic.
# reference: https://en.wikipedia.org/wiki/IEEE_754
## The default integer type. Size depends on architecture.
@[copy, magic]
pub type int
## A signed 8-bit integer.
@[copy, magic]
pub type i8
## A signed 16-bit integer.
@[copy, magic]
pub type i16
## A signed 32-bit integer.
@[copy, magic]
pub type i32
## A signed 64-bit integer.
@[copy, magic]
pub type i64
## A signed 128-bit integer.
@[copy, magic]
pub type i128
## The default unsigned integer type. Size depends on architecture.
@[copy, magic]
pub type uint
## An unsigned 8-bit integer.
@[copy, magic]
pub type u8
## An unsigned 16-bit integer.
@[copy, magic]
pub type u16
## An unsigned 32-bit integer.
@[copy, magic]
pub type u32
## An unsigned 64-bit integer.
@[copy, magic]
pub type u64
## An unsigned 128-bit integer.
@[copy, magic]
pub type u128
## A floating-point type. Takes up 64 bits by default.
pub type float = f64
## A 32-bit floating point type. Single precision.
@[copy, magic]
pub type f32
## A 64-bit floating point type. Double precision.
@[copy, magic]
pub type f64
## A 128-bit floating point type. Quadruple precision.
@[copy, magic]
pub type f128
## A decimal type, according to IEEE 754. Takes up 64 bits by default.
pub type decimal = dec64
## A 64-bit decimal type.
@[copy, magic]
pub type dec64
## A 128-bit decimal type.
@[copy, magic]
pub type dec128
## A primitive byte type. 8 bits wide.
pub type byte = u8
## A primitive char type. 4 bytes wide.
## These represent distinct Unicode characters, and are useful with `str`.
pub type chr = u32
## Get the underlying length of a char, in bytes. 1-4.
pub func len(self: chr): uint =
...
## The IEEE floating point value of *Not a Number*.
pub const NaN: f64 = 0x7FF7FFFFFFFFFFFF
## The IEEE floating point value of positive infinity.
pub const Inf: f64 = 0x7FF0000000000000
## The IEEE floating point value of negative infinity.
pub const NegInf: f64 = 0xFFF0000000000000
# todo: type conversions
# fixme: types are all wrong
@[magic]
pub func +[T](a: T, b: T): T
@[magic]
pub func -[T](a: T, b: T): T
@[magic]
pub func *[T](a: T, b: T): T
@[magic]
pub func /[T](a: T, b: T): float
@[magic]
pub func exp[T](a: T, b: T = eulers_number): T
@[magic]
pub func log[T](a: T, b: T = eulers_number): T
@[magic]
pub func abs[T](a: T): T
@[magic]
pub func div[T](a: T, b: T): T
@[magic]
pub func mod[T](a: T, b: T): T
@[magic]
pub func rem[T](a: T, b: T): T
@[magic]
pub func shl[T](a: T): T
@[magic]
pub func shr[T](a: T): T
|