sketch-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bugs #10573] sktrafo_compare isn't transitive


From: Peter Moulder
Subject: [bugs #10573] sktrafo_compare isn't transitive
Date: Mon, 04 Oct 2004 07:00:30 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Galeon/1.3.15 (Debian package 1.3.15-2)

This mail is an automated notification from the bugs tracker
 of the project: Skencil.




/**************************************************************************/
[bugs #10573] Full Item Snapshot:

URL: <http://savannah.nongnu.org/bugs/?func=detailitem&item_id=10573>
Project: Skencil
Submitted by: Peter Moulder
On: lun 04.10.2004 at 10:27

Category:  None
Severity:  5 - Average
Item Group:  Bug
Resolution:  None
Privacy:  Public
Assigned to:  None
Status:  Open
Release:  0.6.x


Summary:  sktrafo_compare isn't transitive

Original Submission:  I'm not sure if this is strictly a bug, but:
sktrafo_compare in Sketch/Modules/sktrafo.c doesn't provide a <a 
href="http://www.sgi.com/tech/stl/StrictWeakOrdering.html";>strict weak 
ordering</a>.  E.g. it isn't transitive: we can have three SkTrafo objects 
a,b,c such that a<b and b<c yet a==c.

This has various consequences.  E.g. sort() on a list of SkTrafo's isn't 
guaranteed to put the list into order; and a dictionary implemented as a tree 
won't work for SkTrafo keys.

To make sktrafo_compare provide a strict weak ordering, you could change the 
comparison to as if it were a sequence of 6 doubles, with m11 being the major 
sort key and so on.
The simplest implementation would be a bitwise comparison memcmp(&a->m11, 
&b->m11, 6*sizeof(double)), which is robust against NaN.
If you wanted to use floating point comparisons rather than bitwise comparison, 
then you'd have to test explicitly for isnan, and have NaN compare, say, 
greater than all non-NaN values (as Java's Double.compareTo does) and equal to 
all NaN values.












For detailed info, follow this link:
<http://savannah.nongnu.org/bugs/?func=detailitem&item_id=10573>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]