Index: TECH/Math.cls.xml =================================================================== diff -u -r3163 -r3164 --- TECH/Math.cls.xml (.../Math.cls.xml) (revision 3163) +++ TECH/Math.cls.xml (.../Math.cls.xml) (revision 3164) @@ -3,7 +3,7 @@ 1 -%RegisteredObject +TECH.RegisteredObject 1 @@ -26,28 +26,17 @@ Getal:%Float,CijfersNaKomma:%Integer=0 %Float om backwards compatible te blijven ; zou eigenlijk moeten 0 zijn + Quit:Getal="." "" ; uitzondering om backwards compatible te blijven ; zou eigenlijk moeten 0 zijn + Quit:$$$Not(Getal[".") +Getal ; indien niet decimaal + Quit:(Getal[".")&&($Length($Piece(Getal,".",2))=CijfersNaKomma) +Getal ; Getal bevat evenveel cijfers na komma als opgegeven CijfersNaKomma - If (Getal < 0) { - If (CijfersNaKomma > 0) { - Set Floored = $Extract(Getal,1,$Find(Getal,".")-1 + CijfersNaKomma) - (1 / 10**CijfersNaKomma) - } Else { - If (##class(TECH.StringUtils).Contains(Getal,".")) { - Set Floored = $Extract(Getal,1,$Find(Getal,".")-2) -1 - } Else { - Set Floored = Getal - } - } + #dim Floored As %Float + #dim Factor As %Integer = 10**CijfersNaKomma + If (Getal >= 0) { + Set Floored = ($piece(Getal*Factor,".")/Factor) } Else { - If (CijfersNaKomma > 0) { - If (##class(TECH.StringUtils).Contains(Getal,".")) { - Set Floored = $Extract(Getal,1,$Find(Getal,".")-1 + CijfersNaKomma) - } Else { - Set Floored = Getal - } - } Else { - Set Floored = $Extract(Getal,1,$Find(Getal,".")-2) - } + Set Floored = ($piece(Getal*Factor-1,".")/Factor) } Quit +Floored