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 NumericPrimitiveThe 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): stringFixed-point decimal rendering. digits is clamped to [0, 100] and defaults to 0.
NumericPrimitive.toString
ts
toString(radix?: int): stringDecimal 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 NumericPrimitiveInstance surface of the primitive int.
IntPrimitive.valueOf
ts
valueOf(): intReturn the receiver's value as an int.
Int8Primitive class
ts
class Int8Primitive extends NumericPrimitiveInstance surface of the primitive int8.
Int8Primitive.valueOf
ts
valueOf(): intReturn the receiver's value as an int.
Int16Primitive class
ts
class Int16Primitive extends NumericPrimitiveInstance surface of the primitive int16.
Int16Primitive.valueOf
ts
valueOf(): intReturn the receiver's value as an int.
Int32Primitive class
ts
class Int32Primitive extends NumericPrimitiveInstance surface of the primitive int32.
Int32Primitive.valueOf
ts
valueOf(): int32Return the receiver's value as an int32.
UintPrimitive class
ts
class UintPrimitive extends NumericPrimitiveInstance surface of the primitive uint.
UintPrimitive.valueOf
ts
valueOf(): uintReturn the receiver's value as a uint.
Uint8Primitive class
ts
class Uint8Primitive extends NumericPrimitiveInstance surface of the primitive uint8.
Uint8Primitive.valueOf
ts
valueOf(): uintReturn the receiver's value as a uint.
Uint16Primitive class
ts
class Uint16Primitive extends NumericPrimitiveInstance surface of the primitive uint16.
Uint16Primitive.valueOf
ts
valueOf(): uintReturn the receiver's value as a uint.
Uint32Primitive class
ts
class Uint32Primitive extends NumericPrimitiveInstance surface of the primitive uint32.
Uint32Primitive.valueOf
ts
valueOf(): uint32Return the receiver's value as a uint32.
CharPrimitive class
ts
class CharPrimitiveInstance 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: intThe character code, 0 to 127.
CharPrimitive.toString
ts
toString(): stringReturn the one-character string.
Float32Primitive class
ts
class Float32Primitive extends NumericPrimitiveInstance surface of the primitive float32.
Float32Primitive.valueOf
ts
valueOf(): floatReturn the receiver's value as a float (float64).
Float64Primitive class
ts
class Float64Primitive extends NumericPrimitiveInstance surface of the primitive float64. float is a strict alias of float64, so both spellings resolve here.
Float64Primitive.valueOf
ts
valueOf(): float64Return the receiver's value as a float64.
Generated from lang/types/builtin_primitives.d.tks in the ThicketScript repository.