[Bug 1556588] Re: Hash collision

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Bug 1556588] Re: Hash collision

Hliaire Fernandes
Pharo suffers from bad hash value for Float generating unexpected collisions on numbers as 0.5 and -0.5.
As a result Point item in DrGeo are too often seen as duplicated but there are not.

The proper way to fix this issue: in the Dr. Geo's Factory when there is
hash equality between two geometric items, it should then check for the
logical (ontological) equality of these two items

Code to implement it:

DrGFactory>>indexOf: anItem in: aPool
"No identity equality but hashed value to detect duplicated object we must consider as equal"
 ^ anItem
                ifNil: [0]
                ifNotNil: [aPool findFirst: [ :each |
                                each hash = anItem hash  
                                        and: ["double check when hash is equal (can be a collision)"
                                                 each = anItem ]  

** Changed in: drgeo
       Status: Fix Released => New

** Changed in: drgeo
    Milestone: 16.03 => wip

** Changed in: drgeo
     Assignee: (unassigned) => hilaire (hilaire-fernandes)

You received this bug notification because you are a member of DrGeo
developers, which is subscribed to Dr. Geo II.
Matching subscriptions: Dr. Geo bug report

  Hash collision

Status in Dr. Geo II:

Bug description:
  We have collision between DrGPointIntersection and DrGSegment2Points

  Althought parents of these two instances:
  - two circles
  - two point

  It occurs with Koch and Durer scripts

To manage notifications about this bug go to: