digitalmars.D.bugs - BUG: Sorting array of real's doesn't correctly sort things
- Russ Lewis <spamhole-2001-07-16 deming-os.org> Oct 11 2004
- "Thomas Kuehne" <eisvogel users.sourceforge.net> Oct 13 2004
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: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
added to destress as svn://svn.kuehne.cn/dstress/run/sort_03.d in addition the following striped down code segfaults: # real[10] array; # real[] copy = array.dup; # copy.sort; testcase svn://svn.kuehne.cn/dstress/run/dup_04.d Thomas
Oct 13 2004








"Thomas Kuehne" <eisvogel users.sourceforge.net>