You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: markdown-pages/docs/manual/primitive-types.mdx
+21-15Lines changed: 21 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -148,6 +148,12 @@ ReScript's `true/false` compiles into a JavaScript `true/false`.
148
148
149
149
32-bits, truncated when necessary. We provide the usual operations on them: `+`, `-`, `*`, `/`, etc. See [Int](/docs/manual/api/stdlib/int) for helper functions.
150
150
151
+
Integer operators include `+`, `-`, `*`, `/`, `**`, and `%`.
152
+
153
+
`%` keeps the familiar `mod` naming, but its semantics are remainder (same behavior as JavaScript `%`).
**Be careful when you bind to JavaScript numbers!** Since ReScript integers have a much smaller range than JavaScript numbers, data might get lost when dealing with large numbers. In those cases it’s much safer to bind the numbers as **float**. Be extra mindful of this when binding to JavaScript Dates and their epoch time.
152
158
153
159
To improve readability, you may place underscores in the middle of numeric literals such as `1_000_000`. Note that underscores can be placed anywhere within a number, not just every three digits.
@@ -156,6 +162,8 @@ To improve readability, you may place underscores in the middle of numeric liter
156
162
157
163
Float requires other operators: `+.`, `-.`, `*.`, `/.`, etc. Like `0.5 +. 0.6`. See [Float](/docs/manual/api/stdlib/float) for helper functions.
158
164
165
+
Float also supports `**` (exponentiation) and `%` (remainder semantics).
166
+
159
167
As with integers, you may use underscores within literals to improve readability.
160
168
161
169
### Int-to-Float Coercion
@@ -179,7 +187,7 @@ var result = 1 + 2;
179
187
**Since 11.1**
180
188
181
189
For values which are too large to be represented by Int or Float, there is the `bigint` primitive type.
182
-
We provide the usual operations on them: `+`, `-`, `*`, `/`, etc. See [BigInt](/docs/manual/api/stdlib/bigint) for helper functions.
190
+
We provide the usual operations on them: `+`, `-`, `*`, `/`, `**`, `%`, etc. See [BigInt](/docs/manual/api/stdlib/bigint) for helper functions.
183
191
184
192
A `bigint` number is denoted by a trailing `n` like so: `42n`.
185
193
@@ -209,28 +217,26 @@ It also supports all the bitwise operations, except unsigned shift right (`>>>`)
Copy file name to clipboardExpand all lines: markdown-pages/syntax-lookup/language_char_literal.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ id: "char-literal"
3
3
keywords: ["char"]
4
4
name: "' '"
5
5
summary: "This is the `char` literal syntax."
6
-
category: "languageconstructs"
6
+
category: "languagepatternsvalues"
7
7
---
8
8
9
9
A `char` literal is composed of two **single** quotes. Double quotes are reserved for the `string` type. Note that `char` is essentially an integer in JS since version 10.0.
0 commit comments