Nitpick API Reference
This document is auto-generated from source code
/// annotations in stdlib and
npklibc.
stdlib/number.npk
func:create = Number(flt128:v) {
Primary constructor — called by instance
func:from_int = Number(int64:v) {
Construct from a 64-bit signed integer. Integers whose absolute value fits in 53 bits (±9007199254740992) are exactly representable; larger values up to ±2^113 remain exact.
func:from_float = Number(flt64:v) {
Construct from a 64-bit float. The value is widened to flt128 — no precision is lost during construction.
func:add = Number(Number:self, Number:other) {
Return self + other.
func:sub = Number(Number:self, Number:other) {
Return self - other.
func:mul = Number(Number:self, Number:other) {
Return self * other.
func:div = Number(Number:self, Number:other) {
Return self / other. Returns error if divisor is zero.
func:neg = Number(Number:self) {
Return -self.
func:to_flt32 = flt32(Number:self) {
Extract as flt32. May lose precision or range; always succeeds.
func:to_flt64 = flt64(Number:self) {
Extract as flt64 (double precision). Values requiring more than 53 bits of mantissa will lose precision.
func:to_flt128 = flt128(Number:self) {
Extract as flt128. Lossless — same as the backing store type.
func:to_int64 = int64(Number:self) {
Extract as int64. Truncates the fractional part (rounds toward zero). Returns error if the value is outside [-9223372036854775808, 9223372036854775807].
func:to_int32 = int32(Number:self) {
Extract as int32. Truncates the fractional part (rounds toward zero). Returns error if the value is outside [-2147483648, 2147483647].