digitalmars.D.bugs - BUG: Sorting array of real's doesn't correctly sort things
- Russ Lewis (3/25) Oct 11 2004 The first several lines of ouput are
- Thomas Kuehne (8/33) Oct 13 2004 added to destress as svn://svn.kuehne.cn/dstress/run/sort_03.d
The following code (Linux, 0.102) demonstrates that an array of real's is not sorted correctly:import std.stdio; int main() { real[1000] array; for(int i=999; i>=0; i--) array[999-i] = (cast(real)i)/8; real[] sorted_copy = array.dup; sorted_copy.sort; for(int i=0; i<1000; i++) writef("%f\n", sorted_copy[i]); return 0; }The first several lines of ouput are0.375000 0.000000 0.500000 0.625000 0.250000 0.125000 2.000000
Oct 11 2004
Russ Lewis schrieb:The following code (Linux, 0.102) demonstrates that an array of real's is not sorted correctly:added to destress as svn://svn.kuehne.cn/dstress/run/sort_03.d in addition the following striped down code segfaults: testcase svn://svn.kuehne.cn/dstress/run/dup_04.d Thomasimport std.stdio; int main() { real[1000] array; for(int i=999; i>=0; i--) array[999-i] = (cast(real)i)/8; real[] sorted_copy = array.dup; sorted_copy.sort; for(int i=0; i<1000; i++) writef("%f\n", sorted_copy[i]); return 0; }The first several lines of ouput are0.375000 0.000000 0.500000 0.625000 0.250000 0.125000 2.000000
Oct 13 2004