The new Decimal API

This commit is contained in:
Krasimir Angelov
2023-08-21 20:14:26 +02:00
parent 58da8deca8
commit fb398c603e
147 changed files with 918 additions and 188 deletions

View File

@@ -57,6 +57,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu
Numeral = {s,p : Str} ;
Card, Digits = {s : Str} ;
Decimal = {s : Str ; hasDot : Bool} ;
-- Structural

View File

@@ -62,6 +62,7 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in {
NumCard n = n ** {numType = NTFull} ;
NumDigits d = d ** {numType = NTFull} ;
NumDecimal d = d ** {numType = NTFull} ;
OrdDigits d = {s = ordinal_s ++ d.s} ;
NumNumeral numeral = {s = numeral.p} ; -- liang instead of yi

View File

@@ -1,4 +1,4 @@
concrete NumeralChi of Numeral = CatChi [Numeral,Digits] ** open ResChi, Prelude in {
concrete NumeralChi of Numeral = CatChi [Numeral,Digits,Decimal] ** open ResChi, Prelude in {
flags coding = utf8 ;
@@ -162,4 +162,16 @@ lin pot4as5 n = n ;
D_8 = ss "8" ;
D_9 = ss "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = "-" ++ BIND ++ d.s ;
hasDot=False
} ;
IFrac d i = {
s=d.s ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s;
hasDot=True
} ;
}

View File

@@ -160,4 +160,16 @@ lin pot3plus n m =
D_8 = ss "8" ;
D_9 = ss "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = "-" ++ BIND ++ d.s ;
hasDot=False
} ;
IFrac d i = {
s=d.s ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s;
hasDot=True
} ;
}