digitalmars.D - double[].sort doesn't sort
- Sebastian Beschke (12/12) Feb 19 2005 Hi,
- zwang (16/38) Feb 19 2005 This is due to a bug in phobos/std/typeinfo/ti_double.d.
- Sebastian Beschke (13/21) Feb 19 2005 Thanks, but how do I recompile phobos afterwards? I do
- zwang (3/32) Feb 19 2005 You need to download and install dmc from
- Sebastian Beschke (3/5) Feb 19 2005 I did. It doesn't fix the error. :(
- Manfred Nowak (6/7) Feb 19 2005 [...]
- Sebastian Beschke (5/7) Feb 19 2005 Well, it took me some time to find out how to 'touch' in Windows (I used...
- Matthew (3/10) Feb 19 2005 Check out http://shellext.com/
- Georg Wrede (2/12) Feb 21 2005 Is this on the bug group?
Hi, I'm trying to sort an array of doubles. Before sorting, it contains these values: 0 1 0.5 0.333333 0.666667 0.25 0.5 0.75 0.2 0.4 0.6 0.8 Then I call borders.sort; where borders is the above array. Afterwards the array is: 0.75 1 0.6 0.4 0.2 0.5 0 0.25 0.666667 0.333333 0.5 0.8 In what way is this sorted? I'm afraid I'm not understanding something here. I'm using dmd 0.113. Thanks, Sebastian
Feb 19 2005
Sebastian Beschke wrote:Hi, I'm trying to sort an array of doubles. Before sorting, it contains these values: 0 1 0.5 0.333333 0.666667 0.25 0.5 0.75 0.2 0.4 0.6 0.8 Then I call borders.sort; where borders is the above array. Afterwards the array is: 0.75 1 0.6 0.4 0.2 0.5 0 0.25 0.666667 0.333333 0.5 0.8 In what way is this sorted? I'm afraid I'm not understanding something here. I'm using dmd 0.113. Thanks, SebastianThis is due to a bug in phobos/std/typeinfo/ti_double.d. <code> </code> A quick fix: <code> int compare(void *p1, void *p2) { double d = (*cast(double *)p1 - *cast(double *)p2); return d>0?1:d<0?-1:0; } </code>
Feb 19 2005
zwang schrieb:A quick fix: <code> int compare(void *p1, void *p2) { double d = (*cast(double *)p1 - *cast(double *)p2); return d>0?1:d<0?-1:0; } </code>Thanks, but how do I recompile phobos afterwards? I do C:\dmd\src\phobos>\dm\bin\make -fwin32.mak but it keeps choking on \dm\bin\dmc -c internal\minit.asm masm386 -DM_I386=1 -D_WIN32 -Mx internal\minit.asm; Can't run 'masm386', check PATH Error: '\dm\bin\dmc' not found I even downloaded a "masm386.exe" from somewhere and put it on the PATH, but it still doesn't work. I've never worked with assemblers, I'm afraid ^^ -Sebastian
Feb 19 2005
Sebastian Beschke wrote:zwang schrieb:You need to download and install dmc from ftp://ftp.digitalmars.com/dmc.zipA quick fix: <code> int compare(void *p1, void *p2) { double d = (*cast(double *)p1 - *cast(double *)p2); return d>0?1:d<0?-1:0; } </code>Thanks, but how do I recompile phobos afterwards? I do C:\dmd\src\phobos>\dm\bin\make -fwin32.mak but it keeps choking on \dm\bin\dmc -c internal\minit.asm masm386 -DM_I386=1 -D_WIN32 -Mx internal\minit.asm; Can't run 'masm386', check PATH Error: '\dm\bin\dmc' not found I even downloaded a "masm386.exe" from somewhere and put it on the PATH, but it still doesn't work. I've never worked with assemblers, I'm afraid ^^ -Sebastian
Feb 19 2005
zwang schrieb:You need to download and install dmc from ftp://ftp.digitalmars.com/dmc.zipI did. It doesn't fix the error. :( -Sebastian
Feb 19 2005
Sebastian Beschke wrote: [...]didn't fix[...] Seems you need to `touch' minit.obj, because it is somehow older than minit.asm. -manfred
Feb 19 2005
Manfred Nowak schrieb:Seems you need to `touch' minit.obj, because it is somehow older than minit.asm.Well, it took me some time to find out how to 'touch' in Windows (I used Cygwin in the end -.-), but it finally worked. The sorting bug is also fixed. Thanks Manfred and Zwang. :) -Sebastian
Feb 19 2005
"Sebastian Beschke" <s.beschke gmx.de> wrote in message news:cv7n28$301d$1 digitaldaemon.com...Manfred Nowak schrieb:Check out http://shellext.com/Seems you need to `touch' minit.obj, because it is somehow older than minit.asm.Well, it took me some time to find out how to 'touch' in Windows(I used Cygwin in the end -.-), but it finally worked. The sorting bug is also fixed. Thanks Manfred and Zwang. :) -Sebastian
Feb 19 2005
Sebastian Beschke wrote:zwang schrieb:Is this on the bug group?A quick fix: <code> int compare(void *p1, void *p2) { double d = (*cast(double *)p1 - *cast(double *)p2); return d>0?1:d<0?-1:0; } </code>
Feb 21 2005