import std.random; void main() { auto f = uniform(0.0, 1.0); } $ dmd -m64 -profile profile.d $ ./profile object.Exception@dmd/linux/bin/../../src/phobos/std/random.d(932): Invalid distribution range: [0, 0) ---------------- Compiling it without -profile or m64 works.
Another case: import std.random; void main() { double r1=2*uniform(0.0, 1.0); double r2=2*uniform(0.0, 1.0); } It only fails if both declarations are present. invalid bounding interval [7.69602e+169, -nan) btw, if -inline is added, it yields: invalid bounding interval [7.29112e-304, 1.12477e+218)
I can't reproduce this. What are your compiler version and parameters.
With git dmd on Ubuntu 11.04 it's now: $ dmd -m64 -profile test.d $ ./test object.Exception@std/random.d(940): std.random.uniform(): invalid bounding interval [1.42645e+242, 1.62687e+219)
Floating point causes incorrect values, no errors, reduced down to this code: import std.random : uniform; void main() { uniform(0.0f, 1.0f); } uniform returns values around 1.4203e+31
Created attachment 1081 [details] Disassembly from objdump
https://github.com/D-Programming-Language/druntime/pull/180
Commit pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/c7dc74a32ea823a86304bb874e7308309dce6f37 Merge pull request #180 from dawgfoto/fix5689 fix issue 5689
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a2e777e0c8d8a474ea04fb5d3ef1748638f4e1aa test case for druntime Bug 5689 https://github.com/D-Programming-Language/dmd/commit/6905b385eb70540193f7d890ef48f216c7bc1086 Merge pull request #820 from dawgfoto/fix5689 test case for druntime Bug 5689