diff --git a/moo/kernel/Magnitu.moo b/moo/kernel/Magnitu.moo index 47ff68a..7cbea74 100644 --- a/moo/kernel/Magnitu.moo +++ b/moo/kernel/Magnitu.moo @@ -370,18 +370,23 @@ class(#limited) SmallInteger(Integer) method(#primitive) asError. } -class(#liword,#limited) LargeInteger(Integer) +class(#limited,#immutable,#liword) LargeInteger(Integer) { } -class(#liword,#immutable) LargePositiveInteger(LargeInteger) +class(#limited,#immutable,#liword) LargePositiveInteger(LargeInteger) { method abs { ^self } method sign { ^1 } } -class(#liword,#immutable) LargeNegativeInteger(LargeInteger) +class(#limited,#immutable,#liword) LargeNegativeInteger(LargeInteger) { method abs { ^self negated } method sign { ^-1 } } + +class(#limited,#immutable) FixedPointDecimal(Number) +{ + var value, scale. +} diff --git a/moo/lib/gc.c b/moo/lib/gc.c index 9116150..927e0d9 100644 --- a/moo/lib/gc.c +++ b/moo/lib/gc.c @@ -360,7 +360,7 @@ static kernel_class_info_t kernel_classes[] = { 20, { 'L','a','r','g','e','P','o','s','i','t','i','v','e','I','n','t','e','g','e','r' }, - 0, + MOO_CLASS_SELFSPEC_FLAG_LIMITED, 0, 0, MOO_CLASS_SPEC_FLAG_INDEXED | MOO_CLASS_SPEC_FLAG_IMMUTABLE, @@ -369,7 +369,7 @@ static kernel_class_info_t kernel_classes[] = { 20, { 'L','a','r','g','e','N','e','g','a','t','i','v','e','I','n','t','e','g','e','r' }, - 0, + MOO_CLASS_SELFSPEC_FLAG_LIMITED, 0, 0, MOO_CLASS_SPEC_FLAG_INDEXED | MOO_CLASS_SPEC_FLAG_IMMUTABLE, @@ -381,7 +381,7 @@ static kernel_class_info_t kernel_classes[] = MOO_CLASS_SELFSPEC_FLAG_LIMITED, 0, MOO_FPDEC_NAMED_INSTVARS, - MOO_CLASS_SPEC_FLAG_INDEXED, + MOO_CLASS_SPEC_FLAG_IMMUTABLE, MOO_OBJ_TYPE_OOP, MOO_OFFSETOF(moo_t, _fixed_point_decimal) }, diff --git a/moo/lib/moo-prv.h b/moo/lib/moo-prv.h index ecd3168..9808614 100644 --- a/moo/lib/moo-prv.h +++ b/moo/lib/moo-prv.h @@ -1371,10 +1371,86 @@ moo_oop_t moo_makefpdec ( ); moo_oop_t moo_truncfpdecval ( - moo_t* moo, - moo_oop_t iv, - moo_ooi_t cs, - moo_ooi_t ns + moo_t* moo, + moo_oop_t iv, /* integer */ + moo_ooi_t cs, /* current scale */ + moo_ooi_t ns /* new scale */ +); + +moo_oop_t moo_addnums ( + moo_t* moo, + moo_oop_t x, + moo_oop_t y +); + +moo_oop_t moo_subnums ( + moo_t* moo, + moo_oop_t x, + moo_oop_t y +); + +moo_oop_t moo_mulnums ( + moo_t* moo, + moo_oop_t x, + moo_oop_t y +); + +moo_oop_t moo_mltnums ( + moo_t* moo, + moo_oop_t x, + moo_oop_t y +); + +moo_oop_t moo_divnums ( + moo_t* moo, + moo_oop_t x, + moo_oop_t y +); + +moo_oop_t moo_gtnums ( + moo_t* moo, + moo_oop_t x, + moo_oop_t y +); + +moo_oop_t moo_genums ( + moo_t* moo, + moo_oop_t x, + moo_oop_t y +); + +moo_oop_t moo_ltnums ( + moo_t* moo, + moo_oop_t x, + moo_oop_t y +); + +moo_oop_t moo_lenums ( + moo_t* moo, + moo_oop_t x, + moo_oop_t y +); + +moo_oop_t moo_eqnums ( + moo_t* moo, + moo_oop_t x, + moo_oop_t y +); + +moo_oop_t moo_nenums ( + moo_t* moo, + moo_oop_t x, + moo_oop_t y +); + +moo_oop_t moo_sqrtnum ( + moo_t* moo, + moo_oop_t x +); + +moo_oop_t moo_absnum ( + moo_t* moo, + moo_oop_t x ); /* ========================================================================= */