1
0
forked from GitHub/gf-rgl

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
+15 -1
View File
@@ -1,6 +1,6 @@
--# -path=.:abstract:common:prelude
concrete NumeralLav of Numeral = CatLav [Numeral,Digits] ** open ResLav, ParadigmsLav, Prelude in {
concrete NumeralLav of Numeral = CatLav [Numeral,Digits,Decimal] ** open ResLav, ParadigmsLav, Prelude in {
flags coding = utf8 ;
@@ -109,6 +109,20 @@ lin
D_8 = mkDig "8" ;
D_9 = mkDig "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = \\o => "-" ++ BIND ++ d.s ! o ;
num = Pl ;
hasDot=False
} ;
IFrac d i = {
s = \\o => d.s ! NCard ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ! o;
num = Pl ;
hasDot=True
} ;
oper
mkDig : Str -> Dig = \c -> mk2Dig c Pl ;