rust/src/libcoretest
bors 67ba6dcf68 Auto merge of #24612 - lifthrasiir:flt2dec, r=pnkfelix
This is a direct port of my prior work on the float formatting. The detailed description is available [here](https://github.com/lifthrasiir/rust-strconv#flt2dec). In brief,

* This adds a new hidden module `core::num::flt2dec` for testing from `libcoretest`. Why is it in `core::num` instead of `core::fmt`? Because I envision that the table used by `flt2dec` is directly applicable to `dec2flt` (cf. #24557) as well, which exceeds the realm of "formatting".
* This contains both Dragon4 algorithm (exact, complete but slow) and Grisu3 algorithm (exact, fast but incomplete).
* The code is accompanied with a large amount of self-tests and some exhaustive tests. In particular, `libcoretest` gets a new dependency on `librand`. For the external interface it relies on the existing test suite.
* It is known that, in the best case, the entire formatting code has about 30 KBs of binary overhead (judged from strconv experiments). Not too bad but there might be a potential room for improvements.

This is rather large code. I did my best to comment and annotate the code, but you have been warned.

For the maximal availability the original code was licensed in CC0, but I've also dual-licensed it in MIT/Apache as well so there should be no licensing concern.

This is [breaking-change] as it changes the float output slightly (and it also affects the casing of `inf` and `nan`). I hope this is not a big deal though :)

Fixes #7030, #18038 and #24556. Also related to #6220 and #20870.

## Known Issues

- [x] I've yet to finish `make check-stage1`. It does pass main test suites including `run-pass` but there might be some unknown edges on the doctests.
- [ ] Figure out how this PR affects rustc.
- [ ] Determine which internal routine is mapped to the formatting specifier. Depending on the decision, some internal routine can be safely removed (for instance, currently `to_shortest_str` is unused).
2015-05-09 14:56:56 +00:00
..
fmt test: Fixup many library unit tests 2015-04-14 10:14:19 -07:00
hash Remove integer suffixes where the types in compiled code are identical. 2015-03-05 12:38:33 +05:30
num core: use banker's rounding for the exact mode in flt2dec. 2015-05-06 21:11:14 +09:00
any.rs Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
atomic.rs Rename AtomicInt and AtomicUint 2015-01-11 11:47:44 -08:00
cell.rs Make UnsafeCell, RefCell, Mutex, and RwLock accept DSTs 2015-05-02 10:03:35 +12:00
char.rs Model lexer: Fix remaining issues 2015-04-21 12:02:12 +02:00
clone.rs Remove all i suffixes 2015-01-30 04:38:54 +01:00
cmp.rs std: Bring back f32::from_str_radix as an unstable API 2015-04-21 15:23:54 -07:00
intrinsics.rs Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
iter.rs Optimize iterator adapters. 2015-05-05 14:17:23 -04:00
lib.rs core: added core::num::flt2dec for floating-point formatting. 2015-05-06 14:19:37 +09:00
mem.rs std: Remove #[old_orphan_check] from PartialEq 2015-03-31 13:39:14 -07:00
nonzero.rs Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
ops.rs Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
option.rs Unstub some tests 2015-04-28 21:23:28 -07:00
ptr.rs std: Standardize (input, output) param orderings 2015-03-30 14:08:40 -07:00
result.rs Unstub some tests 2015-04-28 21:23:28 -07:00
slice.rs std: Remove index notation on slice iterators 2015-05-01 10:40:46 -07:00
str.rs Moved coretest::str tests into collectiontest::str 2015-04-05 18:52:58 +02:00
tuple.rs Deprecating i/u suffixes in libcoretest 2015-02-10 22:56:31 +00:00