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,4 +1,4 @@
concrete NumeralGre of Numeral = CatGre [Numeral,Digits] ** open ResGre,Prelude in {
concrete NumeralGre of Numeral = CatGre [Numeral,Digits,Decimal] ** open ResGre,Prelude in {
flags coding= utf8 ;
@@ -291,6 +291,20 @@ Xilias : CardOrd -> (CardOrd => Str) -> Number -> Str = \co,d,n ->
D_8 = mk2Dig "8" Pl;
D_9 = mk2Dig "9" Pl ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = \\o => "-" ++ BIND ++ d.s ! o ;
n = Pl ;
hasDot=False
} ;
IFrac d i = {
s = \\o => d.s ! NCard Neut Nom ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ! o ;
n = Pl ;
hasDot=False
} ;
oper
mk3Dig : Str -> Number -> TDigit = \c,n -> {