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
@@ -4,7 +4,7 @@
-- John J. Camilleri 2011 -- 2013
-- Licensed under LGPL
concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt in {
concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits,Decimal] ** open Prelude,ResMlt in {
flags coding=utf8 ;
@@ -437,4 +437,18 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt
tail = inc i.tail
} ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = \\o => "-" ++ BIND ++ d.s ! o ;
n = d.n ;
hasDot=False
} ;
IFrac d i = {
s=\\o=>d.s ! NumNom ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ! o;
n = d.n;
hasDot=True
} ;
}