stdxdecimal 0.2.0
Proposal for a General Decimal Arithmetic type to Phobos
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
Decimal Type for Phobos
This code is a work in progress for a new type Decimal
that follows the
"General Decimal Arithmetic Specification" http://speleotrove.com/decimal/decarith.html
Current Features
Feature | Implemented |
---|---|
Construction from strings/string-like ranges | ✓ |
Construction from number types | ✓ |
To decimal string | ✓ |
To scientific string | ❌ |
To engineering string | ❌ |
All rounding types | ❌ |
Equals | ❌ |
Compare | ❌ |
Addition/Subtraction | ❌ |
Multiply | ❌ |
Divide | ❌ |
abs | ❌ |
ln | ❌ |
log10 | ❌ |
exp | ❌ |
sqrt | ❌ |
power | ❌ |
reduce | ❌ |
Example
import stdxdecimal;
void main()
{
auto d1 = decimal("1.23");
auto d2 = decimal("1.23E-4");
auto d3 = decimal("1.23E4");
assert(d1.toString() == "1.23");
assert(d2.toString() == "0.000123");
assert(d3.toString() == "12300");
}
- 0.2.0 released 7 years ago
- JackStouffer/stdxdecimal
- BSL 1.0
- Copyright © 2017, Jack Stouffer
- Authors:
- Dependencies:
- none
- Versions:
-
0.5.0 2018-Jan-05 0.4.0 2017-Dec-21 0.3.0 2017-Dec-08 0.2.0 2017-Dec-06 0.1.0 2017-Dec-02 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
518 downloads total
-
- Score:
- 0.9
- Short URL:
- stdxdecimal.dub.pm