Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

nat

🌌nat

natural number of arbitrary size, including zero
represented by its bit sequence

this nat as an i32

this nat as an u32


redefines integer.asString:
convert this to a decimal number in a string. If negative, add "-" as
the first character.

redefines Object.asString:

divide with remainder the two given positive ints
returns the quotient and the remainder
NYI performance: https://cs.opensource.google/go/go/+/refs/tags/go1.19:src/math/big/natdiv.go

return two sequences of equal length
by prepending false to the shorter sequence

modulo
returns the remainder of the division
redefines integer.infix %:
division remainder
redefines numeric.infix %:
basic operations: 'infix %' (division remainder)


redefines numeric.infix %!:

bitwise and
redefines integer.infix &:
bitwise operations

NYI make faster: https://en.wikipedia.org/wiki/Multiplication_algorithm#Computational_complexity_of_multiplication
multiply these natural numbers
redefines numeric.infix *:
basic operations: 'infix *' (multiplication)


redefines numeric.infix *!:


redefines numeric.infix **!:


redefines numeric.infix **?:


redefines numeric.infix **^:

add two natural numbers
redefines numeric.infix +:
basic operations: 'infix +' (addition)


redefines numeric.infix +!:

subtract other from this natural number
redefines numeric.infix -:
basic operations: 'infix -' (substraction)


redefines numeric.infix -!:

divide these natural numbers
redefines numeric.infix /:
basic operations: 'infix /' (division)


redefines numeric.infix /!:

shift left
redefines integer.infix <<:

less or equal
redefines partiallyOrdered.infix <=:
does this come before other?

are these natural numbers equal?
redefines numeric.infix ==:
comparison

shift right
redefines integer.infix >>:
shift operations

bitwise xor
redefines integer.infix ^:

bitwise or
redefines integer.infix |:


redefines numerics.one:
identity element for 'infix *'


redefines partiallyOrdered.orderedThis:
get value of type P.

NYI: Once Eiffel-style 'like this' works, we can use 'like this' instead of
T and no longer need this feature.


redefines numeric.prefix -!:


redefines numeric.thiz:
get numeric.this value of type T. This is used for a generic implemention
of some features (e.g. prefix -, abs


redefines numerics.zero:
identity element for 'infix +'