From 6f2ee656836ddf3822a34a0dbdb124166a41e07f Mon Sep 17 00:00:00 2001 From: YubinChen Date: Fri, 29 Mar 2024 18:29:47 +0800 Subject: [PATCH] add more description for basic types --- README.md | 10 +++++++++- zh-docs/README.md | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 654217a7..2eb78152 100644 --- a/README.md +++ b/README.md @@ -260,7 +260,15 @@ fn init { ### Number -MoonBit supports numeric literals, including decimal, binary, octal, and hexadecimal numbers. +MoonBit have integer type and floating point type: + +|type|description| +|-|-| +|`Int`|32-bit signed integer| +|`Int64`|64-bit signed integer| +|`Double`|64-bit floating point, defined by IEEE754| + +MoonBit also supports numeric literals, including decimal, binary, octal, and hexadecimal numbers. 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. diff --git a/zh-docs/README.md b/zh-docs/README.md index 7253a898..6d593a38 100644 --- a/zh-docs/README.md +++ b/zh-docs/README.md @@ -268,7 +268,15 @@ fn init { ### 数字 -Moonbit 支持的数字字面量,包括十进制、二进制、八进制和十六进制。 +MoonBit 支持整型和浮点类型: + +|类型|描述| +|-|-| +|`Int`|32位有符号整数| +|`Int64`|64位有符号整数| +|`Double`|64位浮点数,由IEEE754定义| + +MoonBit 支持的数字字面量,包括十进制、二进制、八进制和十六进制。 为了提升可读性,你可以在数字字面量内插入下划线,例如 `1_000_000`。 注意,下划线可以插入到数字之间的任何位置,而非只能在每三个数字之间。