Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
July 07, 2014 std.algorithm.sort error with default predicate | ||||
---|---|---|---|---|
| ||||
Using std.algorithm.sort(a,b,c,d,e) I get the error message : core.exception.AssertError@C:\dmd\windows\bin\..\..\src\phobos\std\algorithm.d(1 0350): Predicate for isSorted is not antisymmetric. Both pred(a, b) and pred(b, a) are true for a=Tuple!(float, int, uint[], int, uint[])(-7.56963e-05, 17, [585 105407, 512], 1041, [2732589055, 0]) and b=Tuple!(float, int, uint[], int, uint[ ])(-7.56963e-05, 17, [2732589055, 0], 1105, [585105407, 512]) in positions 25182 and 25183 I am using the default predicate so is it a bug? |
July 07, 2014 Re: std.algorithm.sort error with default predicate | ||||
---|---|---|---|---|
| ||||
Posted in reply to Archibald | Archibald:
> Using std.algorithm.sort(a,b,c,d,e)
But isn't std.algorithm.sort accepting only one argument?
Bye,
bearophile
|
July 07, 2014 Re: std.algorithm.sort error with default predicate | ||||
---|---|---|---|---|
| ||||
Posted in reply to Archibald | On Monday, 7 July 2014 at 20:10:10 UTC, Archibald wrote:
> Using std.algorithm.sort(a,b,c,d,e) I get the error message :
>
> core.exception.AssertError@C:\dmd\windows\bin\..\..\src\phobos\std\algorithm.d(1
> 0350): Predicate for isSorted is not antisymmetric. Both pred(a, b) and pred(b,
> a) are true for a=Tuple!(float, int, uint[], int, uint[])(-7.56963e-05, 17, [585
> 105407, 512], 1041, [2732589055, 0]) and b=Tuple!(float, int, uint[], int, uint[
> ])(-7.56963e-05, 17, [2732589055, 0], 1105, [585105407, 512]) in positions 25182
> and 25183
>
> I am using the default predicate so is it a bug?
Looks like a bad bug:
void main()
{
uint[] a = [0x22_DF_FF_FF];
uint[] b = [0xA2_DF_FF_FF];
assert(!(a < b && b < a)); /* fails */
}
|
July 07, 2014 Re: std.algorithm.sort error with default predicate | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Monday, 7 July 2014 at 20:17:16 UTC, bearophile wrote:
> Archibald:
>
>> Using std.algorithm.sort(a,b,c,d,e)
>
> But isn't std.algorithm.sort accepting only one argument?
>
> Bye,
> bearophile
Sorry, it's sort(zip(a,b,c,d,e))
|
July 07, 2014 Re: std.algorithm.sort error with default predicate | ||||
---|---|---|---|---|
| ||||
Posted in reply to Archibald | Is it chain you are after to concatenate the objects and sort them together? http://dlang.org/phobos/std_range.html#.chain You'd need to cast them all to the same type. On Monday, 7 July 2014 at 20:50:06 UTC, Archibald wrote: > On Monday, 7 July 2014 at 20:17:16 UTC, bearophile wrote: >> Archibald: >> >>> Using std.algorithm.sort(a,b,c,d,e) >> >> But isn't std.algorithm.sort accepting only one argument? >> >> Bye, >> bearophile > > Sorry, it's sort(zip(a,b,c,d,e)) |
July 07, 2014 Re: std.algorithm.sort error with default predicate | ||||
---|---|---|---|---|
| ||||
Posted in reply to anonymous | On Mon, Jul 07, 2014 at 08:35:53PM +0000, anonymous via Digitalmars-d-learn wrote: [...] > Looks like a bad bug: > > void main() > { > uint[] a = [0x22_DF_FF_FF]; > uint[] b = [0xA2_DF_FF_FF]; > assert(!(a < b && b < a)); /* fails */ > } This looks pretty serious. Please file a bug: http://issues.dlang.org/ T -- People tell me I'm stubborn, but I refuse to accept it! |
July 08, 2014 Re: std.algorithm.sort error with default predicate | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | H. S. Teoh: > This looks pretty serious. Please file a bug: > > http://issues.dlang.org/ I have filed it myself, as "major": https://issues.dlang.org/show_bug.cgi?id=13073 Bye, bearophile |
Copyright © 1999-2021 by the D Language Foundation