rust/src/libstd
bors 986d1f78be auto merge of #10196 : huonw/rust/fix-zig, r=alexcrichton
The code was using (in the notation of Doornik 2005) `f(x_{i+1}) -
f(x_{i+2})` rather than `f(x_i) - f(x_{i+1})`. This corrects that, and
removes the F_DIFF tables which caused this problem in the first place.

They `F_DIFF` tables are a micro-optimisation (in theory, they could
easily be a micro-pessimisation): that `if` gets hit about 1% of the
time for Exp/Normal, and the rest of the condition involves RNG calls
and a floating point `exp`, so it is unlikely that saving a single FP
subtraction will be very useful (especially as more tables means more
memory reads and higher cache pressure, as well as taking up space in
the binary (although only ~2k in this case)).

Closes #10084. Notably, unlike that issue suggests, this wasn't a
problem with the Exp tables. It affected Normal too, but since it is
symmetric, there was no bias in the mean (as the bias was equal on the
positive and negative sides and so cancelled out) but it was visible as
a variance slightly lower than it should be.

New plot:

![exp-density](https://f.cloud.github.com/assets/1203825/1445796/42218dfe-422a-11e3-9f98-2cd146b82b46.png)

I've started writing some tests in [huonw/random-tests](https://github.com/huonw/random-tests) (not in the main repo because they can and do fail occasionally, due to randomness, but it is on Travis and Rust-CI so it will hopefully track the language), unsurprisingly, they're [currently failing](https://travis-ci.org/huonw/random-tests/builds/13313987) (note that both exp and norm are failing, the former due to both mean and variance the latter due to just variance), but pass at the 0.01 level reliably with this change.

(Currently the only test is essentially a quantitative version of the plots I've been showing, which is run on the `f64` `Rand` instance (uniform 0 to 1), and the Normal and Exp distributions.)
2013-11-01 01:16:22 -07:00
..
fmt Removed unnecessary comments and white spaces as suggested 2013-10-23 01:10:50 +05:30
num auto merge of #9613 : jld/rust/enum-discrim-size.r0, r=alexcrichton 2013-10-30 00:31:23 -07:00
path Remove thread-blocking call to libc::stat in Path::stat 2013-10-22 18:25:07 -07:00
rand std::rand: correct an off-by-one in the Ziggurat code. 2013-10-31 23:49:39 +11:00
rt libstd: Remove mocks. 2013-10-31 10:30:57 -07:00
str Removed Unnecessary comments and white spaces #4386 2013-10-23 01:10:50 +05:30
task Prepared std::sys for removal, and made begin_unwind simpler 2013-10-30 21:19:18 +01:00
unstable auto merge of #10120 : Kimundi/rust/remove_sys, r=alexcrichton 2013-10-30 18:31:26 -07:00
any.rs Allow fail messages to be caught, and introduce the Any trait 2013-10-28 08:50:32 +01:00
at_vec.rs Rewrite boxed_region/memory_region in Rust 2013-10-26 01:10:39 -07:00
bool.rs Cleaned, documented, wrote tests for up std::bool 2013-10-24 17:21:39 +02:00
borrow.rs std::borrow: Use raw pointer comparison for ref_eq 2013-09-18 06:05:06 +02:00
c_str.rs Remove IoFactoryObject for ~IoFactory 2013-10-24 14:21:57 -07:00
cast.rs std: Move size/align functions to std::mem. #2240 2013-10-17 17:31:35 -07:00
cell.rs Removed Unnecessary comments and white spaces #4386 2013-10-23 01:10:50 +05:30
char.rs Drop the '2' suffix from logging macros 2013-10-22 08:09:56 -07:00
cleanup.rs Rewrite boxed_region/memory_region in Rust 2013-10-26 01:10:39 -07:00
clone.rs remove the float type 2013-10-01 14:54:10 -04:00
cmp.rs Now inline default 'ne' methods 2013-08-30 22:02:24 -04:00
comm.rs auto merge of #10168 : reedlepee123/rust/priv_fields, r=brson 2013-10-30 03:31:20 -07:00
condition.rs Removed Unnecessary comments and white spaces #4386 2013-10-23 01:10:50 +05:30
container.rs container: inline contains_key default method 2013-08-20 22:05:03 -04:00
default.rs std: Add a bunch of Default impls 2013-09-12 18:54:13 -07:00
either.rs Drop the '2' suffix from logging macros 2013-10-22 08:09:56 -07:00
from_str.rs Add from_str docs 2013-09-05 00:58:12 -04:00
hash.rs Clarify that the SipHash implementation has not be validated for cryptographic purposes. 2013-10-27 19:51:19 -04:00
hashmap.rs Removed Unnecessary comments and white spaces #4386 2013-10-23 01:10:50 +05:30
iter.rs Removed unnecessary comments and white spaces as suggested 2013-10-23 01:10:50 +05:30
kinds.rs kinds: update documentation 2013-08-15 21:12:34 -04:00
libc.rs Removed Unnecessary comments and white spaces #4386 2013-10-23 01:10:50 +05:30
local_data.rs Drop the '2' suffix from logging macros 2013-10-22 08:09:56 -07:00
logging.rs Move as much I/O as possible off of native::io 2013-10-24 14:21:57 -07:00
managed.rs Fix an off-by-one in managed::refcount 2013-10-18 09:33:18 -07:00
mem.rs Cleaned, documented, wrote tests for up std::bool 2013-10-24 17:21:39 +02:00
ops.rs Fix a typo in std::ops documentation 2013-10-06 18:51:58 +11:00
option.rs Removed Unnecessary comments and white spaces #4386 2013-10-23 01:10:50 +05:30
os.rs Test fixes and merge conflicts 2013-10-24 14:21:58 -07:00
owned.rs std: implement Total{Ord,Eq} for pointers. 2013-08-04 19:46:52 +10:00
prelude.rs Allow fail messages to be caught, and introduce the Any trait 2013-10-28 08:50:32 +01:00
ptr.rs Implement Clone trait for mutable unsafe pointers 2013-10-25 18:43:55 +09:00
rc.rs Removed Unnecessary comments and white spaces #4386 2013-10-23 01:10:50 +05:30
reflect.rs Adjust reflection for the possibility of discriminants larger than int. 2013-10-29 09:09:20 -07:00
repr.rs Adjust reflection for the possibility of discriminants larger than int. 2013-10-29 09:09:20 -07:00
result.rs Drop the '2' suffix from logging macros 2013-10-22 08:09:56 -07:00
routine.rs libsyntax: Introduce routines and remove all @fns from libsyntax save the old visitor 2013-09-23 18:23:21 -07:00
run.rs librustc: Implement the proc type as sugar for ~once fn and proc 2013-10-29 10:34:17 -07:00
select.rs Make some more rt components public 2013-10-28 13:14:42 -07:00
send_str.rs Implemented IntoSendStr on SendStr to allow naming a 2013-10-05 21:28:04 +02:00
std.rs Prepared std::sys for removal, and made begin_unwind simpler 2013-10-30 21:19:18 +01:00
str.rs Remove IoFactoryObject for ~IoFactory 2013-10-24 14:21:57 -07:00
sys.rs Prepared std::sys for removal, and made begin_unwind simpler 2013-10-30 21:19:18 +01:00
to_bytes.rs Remove std::io once and for all! 2013-10-24 14:22:34 -07:00
to_str.rs std: Remove usage of fmt! 2013-09-30 23:21:18 -07:00
trie.rs Removed Unnecessary comments and white spaces #4386 2013-10-23 01:10:50 +05:30
tuple.rs std: Replace CloneableTuple with Tuple, which takes self by-val. 2013-09-25 19:00:08 +10:00
unicode.rs rename std::iterator to std::iter 2013-09-09 03:21:46 -04:00
unit.rs std: Add a bunch of Default impls 2013-09-12 18:54:13 -07:00
util.rs std: Move size/align functions to std::mem. #2240 2013-10-17 17:31:35 -07:00
vec.rs Removed Unnecessary comments and white spaces #4386 2013-10-23 01:10:50 +05:30