# 数字
¥Number
基本数值的封装。
¥Wrappers for basic numerical values.
Number 对象也已根据基本 WebAssembly 类型分为一个类。与 JavaScript 不同,这些类不能有实际实例,因此它的工作方式与 JavaScript 的 (MDN (opens new window)) 有点不同。
¥The Number object has been split into one class per basic WebAssembly type as well. Unlike in JavaScript, these classes cannot have actual instances, hence it works a bit different than JavaScript's (MDN (opens new window)).
# 整数
¥Integers
下面的名称 Number 代表封装器 I8、I16、I32、I64、U8、U16、U32 或 U64 之一,代表它们各自的基本整数类型 T。
¥The name Number below stands for one of the wrappers I8, I16, I32, I64, U8, U16, U32 or U64 representing their respective basic integer type T.
# 静态成员
¥Static members
const MIN_VALUE: T各个基本类型的最小可表示值。与浮点值不同,浮点值是最小的可表示正值。
¥The smallest representable value of the respective basic type. Differs from floating point values where it is the smallest representable positive value.
const MAX_VALUE: T各个基本类型的最大可表示值。
¥The largest representable value of the respective basic type.
function parseInt(value: string, radix?: i32): T将字符串解析为相应基本类型的值。
¥Parses a string to a value of the respective basic type.
# 实例成员
¥Instance members
function toString(radix?: i32): string返回转换为字符串的相应基本值。
¥Returns the respective basic value converted to a string.
# 花车
¥Floats
下面的名称 Number 代表封装器 F32 或 F64 之一,代表它们各自的基本浮点类型 T。
¥The name Number below stands for one of the wrappers F32 or F64 representing their respective basic floating point type T.
# 静态成员
¥Static members
const EPSILON: T1.0与比1.0大的最小数之差。¥The difference between
1.0and the smallest number larger than1.0.const MAX_VALUE: T相应基本类型的最大可表示正值。
¥The largest representable positive value by the respective basic type.
const MIN_VALUE: T相应基本类型的最小可表示正值。
¥The smallest representable positive value by the respective basic type.
const MAX_SAFE_INTEGER: T相应基本类型可表示的最大安全整数。
¥The largest safe integer representable by the respective basic type.
const MIN_SAFE_INTEGER: T相应基本类型可表示的最小安全整数。
¥The smallest safe integer representable by the respective basic type.
const POSITIVE_INFINITY: T相应基本类型的正无穷大。
¥Positive infinity of the respective basic type.
const NEGATIVE_INFINITY: T相应基本类型的负无穷大。
¥Negative infinity of the respective basic type.
const NaN: T相应基本类型的 NaN(非数字)。
¥NaN (Not A Number) of the respective basic type.
function isNaN(value: T): bool测试该值是否为
NaN。¥Tests if the value is
NaN.function isFinite(value: T): bool测试该值是否是有限的,即不是
NaN、POSITIVE_INFINITY或NEGATIVE_INFINITY.¥Tests if the value is finite, that is not
NaN,POSITIVE_INFINITYorNEGATIVE_INFINITY.function isInteger(value: T): bool测试该值是否为整数。
¥Tests if the value is an integer.
function isSafeInteger(value: T): bool测试该值是否是安全整数。
¥Tests if the value is a safe integer.
function parseInt(value: string, radix?: i32): T将字符串解析为相应基本类型的整数值。
¥Parses a string to an integer value of the respective basic type.
function parseFloat(value: string): T将字符串解析为相应基本类型的浮点值。
¥Parses a string to a float value of the respective basic type.
# 实例成员
¥Instance members
function toString(radix?: i32): string返回转换为字符串的相应基本值。目前此处忽略
radix参数。¥Returns the respective basic value converted to a string. The
radixparameter is currently ignored here.