Bug 63226 - Array.sort( func ) broken if func returns ± Infinity
Summary: Array.sort( func ) broken if func returns ± Infinity
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: kjs (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-25 11:11 UTC by zack-weg
Modified: 2003-09-30 15:03 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zack-weg 2003-08-25 11:11:21 UTC
Version:            (using KDE KDE 3.1.2)
Installed from:    Gentoo Packages
Compiler:          gcc 3.2.3 
OS:          Linux

This gives [Infinity, 0] instead of [0, Infinity]:

  [0, Infinity].sort( function ( a, b ) { return a - b } );

sort() doesn't seem to handle ±Infinity as return values of the
compare function correctly. ECMAScript doesn't exclude ±Infinity as possible return values.
Comment 1 zack-weg 2003-08-25 11:44:41 UTC
Actually, every return value not fitting into 32 bit fails.
Comment 2 zack-weg 2003-08-27 01:06:49 UTC
After looking at the code, this seems to fixed with revision 1.48 of
kdelibs/kjs/array_object.cpp , but I leave this bug open until I can verify in
the next release.

http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdelibs/kjs/array_object.cpp#rev1.48
Comment 3 Harri Porten 2003-09-30 15:03:32 UTC
Your test case (added to khtmltests/js/Array.js) indeed works with
current CVS. Closing.