Skip to content

Commit 442b45e

Browse files
Johan Alkstålcristianoc
Johan Alkstål
authored andcommitted
Update primitive-types.mdx
The description of Integers was not as clear on why you should be careful when binding to numbers as it could be. Tried to describe a bit more why you should be careful.
1 parent d7cc493 commit 442b45e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pages/docs/manual/latest/primitive-types.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ ReScript's `true/false` compiles into a JavaScript `true/false`.
156156

157157
32-bits, truncated when necessary. We provide the usual operations on them: `+`, `-`, `*`, `/`, etc. See [Js.Int](api/js/int) for helper functions.
158158

159-
**Careful when you bind to JavaScript numbers**! Long ones might be truncated. Bind JS number (especially Dates) as **float** instead.
159+
**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.
160160

161161
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.
162162

0 commit comments

Comments
 (0)