Releasing 5.0.0 today, maybe with FFA.sort()

Nick Wellnhofer wellnhofer at aevum.de
Tue Jan 15 22:42:04 UTC 2013


This function is quite obviously wrong:

    PARROT_PURE_FUNCTION
    static int
    auxcmpfunc(ARGIN(const FLOATVAL *i), ARGIN(const FLOATVAL *j))
    {
        ASSERT_ARGS(auxcmpfunc)
        return (int) (*i - *j);
    }

You can't just cast a floating-point difference to integer and expect it would do the right thing. Every result between -0.5 and 0.5 will result in a zero integer meaning equality although the values compared are in fact different. Something like that should work:

    if (*i == *j) return 0;
    if (*i <  *j) return -1;
    else          return 1;

On another note, the line "ASSERT_ARGS(auxcmpfunc)" is useless. auxcmpfunc will always be non-null.

HTH,
Nick


On Jan 15, 2013, at 20:11 , Jonathan Duke Leto <jonathan at leto.net> wrote:

> Howdy,
> 
> I will be releasing 5.0.0 today. Last night I thought it would be a good idea to add a .sort() method to FixedFloatArrays, which did not previously have that method.
> 
> Of course, "everything worked fine on my machine", but some compilers cause the tests to fail :
> 
> http://smolder.parrot.org/app/projects/tap_stream/34325/151
> 
> The commits in question are these:
> 
> https://github.com/parrot/parrot/commit/b52608b816b4ffcc1b7a78c7fa2e84fae8114fda
> 
> https://github.com/parrot/parrot/commit/3f65128bb28e5b76c48d064b9bbc782fd3b4f4a7
> 
> If anybody has any idea why these tests would pass on Clang 2.8, but fail on Clang 3.1 (on Travis), you will be showered with karma.
> 
> If this can't be resolved soon, I will just back out those commits from 5.0.0.
> 
> Have an awesome day!
> 
> Duke
> 
> -- 
> Jonathan "Duke" Leto <jonathan at leto.net>
> Leto Labs LLC http://labs.leto.net
> 209.691.DUKE http://dukeleto.pl _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev



More information about the parrot-dev mailing list