Skip to content

Number methods ​

Methods you can call on a number value, such as n.toFixed(2). The class names on this page are internal; you never write them in code.

Always available

No import needed. These names are in scope in every file.

NumericPrimitive class ​

ts
class NumericPrimitive

The shared half of every numeric primitive's instance surface. valueOf is not here because it returns the RECEIVER, so its type is the receiver's own width; each subclass declares its own.

NumericPrimitive.toFixed ​

ts
toFixed(digits?: int): string

Fixed-point decimal rendering. digits is clamped to [0, 100] and defaults to 0.

NumericPrimitive.toString ​

ts
toString(radix?: int): string

Decimal rendering, or base-radix when radix is given. radix outside [2, 36] throws RangeError; a non-10 radix renders the value truncated to an integer.

IntPrimitive class ​

ts
class IntPrimitive extends NumericPrimitive

Instance surface of the primitive int.

IntPrimitive.valueOf ​

ts
valueOf(): int

Return the receiver's value as an int.

Int8Primitive class ​

ts
class Int8Primitive extends NumericPrimitive

Instance surface of the primitive int8.

Int8Primitive.valueOf ​

ts
valueOf(): int

Return the receiver's value as an int.

Int16Primitive class ​

ts
class Int16Primitive extends NumericPrimitive

Instance surface of the primitive int16.

Int16Primitive.valueOf ​

ts
valueOf(): int

Return the receiver's value as an int.

Int32Primitive class ​

ts
class Int32Primitive extends NumericPrimitive

Instance surface of the primitive int32.

Int32Primitive.valueOf ​

ts
valueOf(): int32

Return the receiver's value as an int32.

UintPrimitive class ​

ts
class UintPrimitive extends NumericPrimitive

Instance surface of the primitive uint.

UintPrimitive.valueOf ​

ts
valueOf(): uint

Return the receiver's value as a uint.

Uint8Primitive class ​

ts
class Uint8Primitive extends NumericPrimitive

Instance surface of the primitive uint8.

Uint8Primitive.valueOf ​

ts
valueOf(): uint

Return the receiver's value as a uint.

Uint16Primitive class ​

ts
class Uint16Primitive extends NumericPrimitive

Instance surface of the primitive uint16.

Uint16Primitive.valueOf ​

ts
valueOf(): uint

Return the receiver's value as a uint.

Uint32Primitive class ​

ts
class Uint32Primitive extends NumericPrimitive

Instance surface of the primitive uint32.

Uint32Primitive.valueOf ​

ts
valueOf(): uint32

Return the receiver's value as a uint32.

CharPrimitive class ​

ts
class CharPrimitive

Instance surface of the primitive char: one ASCII character, held as a one-character string. c.code is its character code.

CharPrimitive.code ​

ts
readonly code: int

The character code, 0 to 127.

CharPrimitive.toString ​

ts
toString(): string

Return the one-character string.

Float32Primitive class ​

ts
class Float32Primitive extends NumericPrimitive

Instance surface of the primitive float32.

Float32Primitive.valueOf ​

ts
valueOf(): float

Return the receiver's value as a float (float64).

Float64Primitive class ​

ts
class Float64Primitive extends NumericPrimitive

Instance surface of the primitive float64. float is a strict alias of float64, so both spellings resolve here.

Float64Primitive.valueOf ​

ts
valueOf(): float64

Return the receiver's value as a float64.


Generated from lang/types/builtin_primitives.d.tks in the ThicketScript repository.