Proposal for a standard Decimal type in alpha

Nathan S. no.public.email at example.com
Fri Dec 22 08:32:03 UTC 2017


On Thursday, 21 December 2017 at 13:59:28 UTC, Jack Stouffer 
wrote:
> I just finished getting the type into an alpha version, and I 
> wanted to solicit people's opinions on the API and if I'm 
> heading in the right direction with this.
>
> The dub page: https://code.dlang.org/packages/stdxdecimal
>
> The docs: https://jackstouffer.github.io/stdxdecimal/
>
> What you can do so far:
>
> * Control behavior with a Hook type a-la 
> std.experimental.checkedint
> * Addition, subtraction, multiplication, division
> * Construction from a strings and built-in number types

I think it would be clearer if the precision, the rounding mode, 
and the error behavior were three separate parameters instead of 
a single Hook. Predefined settings named "Abort", "Throw", and 
"NoOp" would then be self-explanatory, and it wouldn't be 
necessary to entirely rewrite them if you wanted precision of 10 
or 20 decimal digits instead of 9 or wanted to use a different 
rounding mode.


More information about the Digitalmars-d-announce mailing list