1212
1313
1414
15- Arbitary -precision decimal numbers implemented in pure Rust.
15+ Arbitrary -precision decimal numbers implemented in pure Rust.
1616
1717## Community
1818
1919Join the conversation on Zulip: https://bigdecimal-rs.zulipchat.com
2020
21+ Please share important stuff like use-cases, issues, benchmarks, and
22+ naming-convention preferences.
23+
24+ This project is currently being re-written, so if performance or flexibility
25+ is lacking, check again soon and it may be fixed.
26+
2127## Usage
2228
2329Add bigdecimal as a dependency to your ` Cargo.toml ` file:
@@ -47,15 +53,21 @@ sqrt(2) = 1.41421356237309504880168872420969807856967187537694807317667973799073
4753
4854### Compile-Time Configuration
4955
50- You can set a few default parameters at compile-time via environment variables.
56+ You can set a few default parameters at _ compile-time _ via environment variables:
5157
52- +-------------------------------------------------+------------+
5358| Environment Variable | Default |
54- + -------------------------------------------------+ ------------+
59+ | -------------------------------------------------| ------------|
5560| ` RUST_BIGDECIMAL_DEFAULT_PRECISION ` | 100 |
5661| ` RUST_BIGDECIMAL_DEFAULT_ROUNDING_MODE ` | ` HalfEven ` |
5762| ` RUST_BIGDECIMAL_EXPONENTIAL_FORMAT_THRESHOLD ` | 5 |
58- +-------------------------------------------------+------------+
63+
64+ These allow setting the default [ Context] fields globally without incurring a runtime lookup,
65+ or having to pass Context parameters through all calculations.
66+ (If you want runtime control over these fields, you will have to pass Contexts to your functions.)
67+ Examine [ build.rs] for how those are converted to constants in the code (if interested).
68+
69+ [ Context ] : https://docs.rs/bigdecimal/latest/bigdecimal/struct.Context.html
70+ [ build.rs ] : ./build.rs
5971
6072
6173#### Default precision
@@ -65,14 +77,14 @@ The default value of this variable is 100.
6577
6678This will be used as maximum precision for operations which may produce infinite digits (inverse, sqrt, ...).
6779
68- Note that other operations, such as multiplication, will preserve all digits, so multiplying two 70 digit numbers
69- will result in one 140 digit number.
70- The user will have to manually trim the number of digits after calculations to reasonable amounts using the
71- ` x.with_prec(30) ` method.
72-
73- A new set of methods with explicit precision and rounding modes is being worked on, but even after those
74- are introduced the default precision will have to be used as the implicit value.
80+ Note that other operations, such as multiplication, will preserve all digits;
81+ so multiplying two 70 digit numbers will result in one 140 digit number.
82+ The user will have to manually trim the number of digits after calculations to
83+ reasonable amounts using the ` x.with_prec(30) ` method.
7584
85+ A new set of methods with explicit precision and rounding modes is being worked
86+ on, but even after those are introduced the default precision will have to be
87+ used as the implicit value.
7688
7789#### Rounding mode
7890
@@ -132,12 +144,6 @@ $ cargo run
132144> This is for flexibility and performance.
133145
134146
135- ## Improvements
136-
137- Work is being done on this codebase again and there are many features
138- and improvements on the way.
139-
140-
141147## About
142148
143149This repository contains code originally meant for a bigdecimal module
0 commit comments