mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-29 04:46:30 -06:00
The new Decimal API
This commit is contained in:
@@ -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
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user