Summary: std.algorithm.sort asserts unexpectedly with certain
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Peter Alexander <> 2010-09-26 
14:10:13 PDT ---
The following code asserts unexpectedly when compiled with DMD 2.048 using no

void main()
    alias Tuple!(int, "x", int, "y") V;
    V[] vs = [V(3, 4), V(6, 8)];    
    float arg(V v) { return atan2(cast(float)v.y, cast(float)v.x); }
    bool order(V a, V b) { return arg(a) < arg(b); }

Attempting to fetch the front of an empty array

It does not assert when the arg(V) function is replaced to be something more
simple, and only asserts when vs has particular values.

I suspect this has something to do with floating point inaccuracies with atan2,
but haven't looked deep enough into the issue.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to