Nanyx
PlaygroundPackages

prelude: sized numbers

Arithmetic, comparison, hashing and text for I8 to U64 and F32

The definitions attached to the sized number types, I8, I16, I32, U8, U16, U32, U64 and F32, that give each the operators and contexts int and float have, and the wrapping arithmetic of int and the sized integers. They are in the prelude, so no import is needed. Converting between them is on the conversions page.

Reference

I8.zero

def I8.zero: I8

I8.`+`

def I8.`+`: I8, I8 -> I8

I8.`-`

def I8.`-`: I8, I8 -> I8

I8.negate

def I8.negate: I8 -> I8

I8.`*`

def I8.`*`: I8, I8 -> I8

I8.`/`

def I8.`/`: I8, I8 -> I8

I8.`%`

def I8.`%`: I8, I8 -> I8

I8.fromInt

def I8.fromInt: int -> I8

I8.isInteger

def I8.isInteger: bool

I8.compare

def I8.compare: I8, I8 -> #less | #equal | #greater

I8.hash

def I8.hash: I8 -> int

I8.toString

def I8.toString: I8 -> string

I16.zero

def I16.zero: I16

I16.`+`

def I16.`+`: I16, I16 -> I16

I16.`-`

def I16.`-`: I16, I16 -> I16

I16.negate

def I16.negate: I16 -> I16

I16.`*`

def I16.`*`: I16, I16 -> I16

I16.`/`

def I16.`/`: I16, I16 -> I16

I16.`%`

def I16.`%`: I16, I16 -> I16

I16.fromInt

def I16.fromInt: int -> I16

I16.isInteger

def I16.isInteger: bool

I16.compare

def I16.compare: I16, I16 -> #less | #equal | #greater

I16.hash

def I16.hash: I16 -> int

I16.toString

def I16.toString: I16 -> string

I32.zero

def I32.zero: I32

I32.`+`

def I32.`+`: I32, I32 -> I32

I32.`-`

def I32.`-`: I32, I32 -> I32

I32.negate

def I32.negate: I32 -> I32

I32.`*`

def I32.`*`: I32, I32 -> I32

I32.`/`

def I32.`/`: I32, I32 -> I32

I32.`%`

def I32.`%`: I32, I32 -> I32

I32.fromInt

def I32.fromInt: int -> I32

I32.isInteger

def I32.isInteger: bool

I32.compare

def I32.compare: I32, I32 -> #less | #equal | #greater

I32.hash

def I32.hash: I32 -> int

I32.toString

def I32.toString: I32 -> string

U8.zero

def U8.zero: U8

U8.`+`

def U8.`+`: U8, U8 -> U8

U8.`-`

def U8.`-`: U8, U8 -> U8

U8.negate

def U8.negate: U8 -> U8

U8.`*`

def U8.`*`: U8, U8 -> U8

U8.`/`

def U8.`/`: U8, U8 -> U8

U8.`%`

def U8.`%`: U8, U8 -> U8

U8.fromInt

def U8.fromInt: int -> U8

U8.isInteger

def U8.isInteger: bool

U8.compare

def U8.compare: U8, U8 -> #less | #equal | #greater

U8.hash

def U8.hash: U8 -> int

U8.toString

def U8.toString: U8 -> string

U16.zero

def U16.zero: U16

U16.`+`

def U16.`+`: U16, U16 -> U16

U16.`-`

def U16.`-`: U16, U16 -> U16

U16.negate

def U16.negate: U16 -> U16

U16.`*`

def U16.`*`: U16, U16 -> U16

U16.`/`

def U16.`/`: U16, U16 -> U16

U16.`%`

def U16.`%`: U16, U16 -> U16

U16.fromInt

def U16.fromInt: int -> U16

U16.isInteger

def U16.isInteger: bool

U16.compare

def U16.compare: U16, U16 -> #less | #equal | #greater

U16.hash

def U16.hash: U16 -> int

U16.toString

def U16.toString: U16 -> string

U32.zero

def U32.zero: U32

U32.`+`

def U32.`+`: U32, U32 -> U32

U32.`-`

def U32.`-`: U32, U32 -> U32

U32.negate

def U32.negate: U32 -> U32

U32.`*`

def U32.`*`: U32, U32 -> U32

U32.`/`

def U32.`/`: U32, U32 -> U32

U32.`%`

def U32.`%`: U32, U32 -> U32

U32.fromInt

def U32.fromInt: int -> U32

U32.isInteger

def U32.isInteger: bool

U32.compare

def U32.compare: U32, U32 -> #less | #equal | #greater

U32.hash

def U32.hash: U32 -> int

U32.toString

def U32.toString: U32 -> string

U64.zero

def U64.zero: U64

U64.`+`

def U64.`+`: U64, U64 -> U64

U64.`-`

def U64.`-`: U64, U64 -> U64

U64.negate

def U64.negate: U64 -> U64

U64.`*`

def U64.`*`: U64, U64 -> U64

U64.`/`

def U64.`/`: U64, U64 -> U64

U64.`%`

def U64.`%`: U64, U64 -> U64

U64.fromInt

def U64.fromInt: int -> U64

U64.isInteger

def U64.isInteger: bool

U64.compare

def U64.compare: U64, U64 -> #less | #equal | #greater

U64.hash

def U64.hash: U64 -> int

U64.toString

def U64.toString: U64 -> string

F32.zero

def F32.zero: F32

F32.`+`

def F32.`+`: F32, F32 -> F32

F32.`-`

def F32.`-`: F32, F32 -> F32

F32.negate

def F32.negate: F32 -> F32

F32.`*`

def F32.`*`: F32, F32 -> F32

F32.`/`

def F32.`/`: F32, F32 -> F32

F32.`%`

def F32.`%`: F32, F32 -> F32

F32.fromInt

def F32.fromInt: int -> F32

F32.isInteger

def F32.isInteger: bool

F32.compare

def F32.compare: F32, F32 -> #less | #equal | #greater

F32.hash

def F32.hash: F32 -> int

F32.toString

def F32.toString: F32 -> string

int.wrappingAdd

def int.wrappingAdd: int, int -> int

x plus y, wrapping around past the largest or smallest int: int.wrappingAdd(9_223_372_036_854_775_807, 1) is the smallest int. Each integer type has its own, I32.wrappingAdd and the rest.

int.wrappingSub

def int.wrappingSub: int, int -> int

x minus y, wrapping around as int.wrappingAdd does.

int.wrappingMul

def int.wrappingMul: int, int -> int

x times y, wrapping around as int.wrappingAdd does.

I8.wrappingAdd

def I8.wrappingAdd: I8, I8 -> I8

I8.wrappingSub

def I8.wrappingSub: I8, I8 -> I8

I8.wrappingMul

def I8.wrappingMul: I8, I8 -> I8

I16.wrappingAdd

def I16.wrappingAdd: I16, I16 -> I16

I16.wrappingSub

def I16.wrappingSub: I16, I16 -> I16

I16.wrappingMul

def I16.wrappingMul: I16, I16 -> I16

I32.wrappingAdd

def I32.wrappingAdd: I32, I32 -> I32

I32.wrappingSub

def I32.wrappingSub: I32, I32 -> I32

I32.wrappingMul

def I32.wrappingMul: I32, I32 -> I32

U8.wrappingAdd

def U8.wrappingAdd: U8, U8 -> U8

U8.wrappingSub

def U8.wrappingSub: U8, U8 -> U8

U8.wrappingMul

def U8.wrappingMul: U8, U8 -> U8

U16.wrappingAdd

def U16.wrappingAdd: U16, U16 -> U16

U16.wrappingSub

def U16.wrappingSub: U16, U16 -> U16

U16.wrappingMul

def U16.wrappingMul: U16, U16 -> U16

U32.wrappingAdd

def U32.wrappingAdd: U32, U32 -> U32

U32.wrappingSub

def U32.wrappingSub: U32, U32 -> U32

U32.wrappingMul

def U32.wrappingMul: U32, U32 -> U32

U64.wrappingAdd

def U64.wrappingAdd: U64, U64 -> U64

U64.wrappingSub

def U64.wrappingSub: U64, U64 -> U64

U64.wrappingMul

def U64.wrappingMul: U64, U64 -> U64