Support for decimal type

I was making a banking app, and realised that there is insufficient  
support for using the decimal type.

On summing a series of amounts I was getting values like 136.6000000345,  
so I was having to do things like

 round(amount*100) div 100

Ideally I would have liked the XPath3 function round(d, precision)
https://www.w3.org/TR/xpath-functions/#func-round

but that still doesn't solve my problem of formatting 25 as 25.00 or 25.6  
as 25.60

XPath3 format-number is a bit heavyweight for my needs
https://www.w3.org/TR/xpath-functions/#func-format-number

How about a function decimal(d, 2) yielding a string with 2 places of  
accuracy?

Steven

Received on Tuesday, 23 January 2018 12:42:19 UTC