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
+11 -1
View File
@@ -1,4 +1,4 @@
concrete NumeralSwa of Numeral = CatSwa [Numeral,Digits] **
concrete NumeralSwa of Numeral = CatSwa [Numeral,Digits,Decimal] **
open Prelude,DiffSwa,MorphoSwa in {
lincat
@@ -76,6 +76,16 @@ lin pot4as5 n = n ;
D_8 = mkDig "8" ;
D_9 = mkDig "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {s=\\o,g=>"-" ++ BIND ++ d.s ! o ! g; hasDot=False; n = Pl} ;
IFrac d i = {
s=\\o,g=>d.s ! NCard ! g ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ! o ! g ;
hasDot=True;
n = Pl
} ;
oper
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ;