Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005222OCamlOCaml generalpublic2011-02-09 13:512012-09-25 20:06
ReporterPascal Cuoq 
Assigned Toxleroy 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.12.0 
Target VersionFixed in Version 
Summary0005222: Hashtbl.hash is not compatible with (=)
DescriptionAccording to http://caml.inria.fr/pub/docs/manual-ocaml/libref/Hashtbl.html [^] :

Hashtbl.hash x associates a positive integer to any value of any type. It is guaranteed that if x = y or Pervasives.compare x y = 0, then hash x = hash y.

But:

        Objective Caml version 3.12.0

# Hashtbl.hash (+0.) ;;
- : int = 0
# Hashtbl.hash (-0.) ;;
- : int = 128
# (+0.) = (-0.) ;;
- : bool = true
#

TagsNo tags attached.
Attached Files

- Relationships
related to 0005225closedxleroy Strengthen the built-in hash function 

-  Notes
(0005838)
xleroy (administrator)
2011-03-04 16:30

Well spotted, thanks. Some normalization of the float is in order before hashing its bits.
(0005935)
xleroy (administrator)
2011-05-29 12:10

As part of a major overhaul of the generic hash function, fixed the +0.0/-0.0 issue, and also made sure that all NaNs hash to the same value. The code is in SVN trunk and should go into release 3.13.

- Issue History
Date Modified Username Field Change
2011-02-09 13:51 Pascal Cuoq New Issue
2011-03-04 16:26 xleroy Relationship added related to 0005225
2011-03-04 16:30 xleroy Note Added: 0005838
2011-03-04 16:30 xleroy Assigned To => xleroy
2011-03-04 16:30 xleroy Status new => confirmed
2011-05-29 12:10 xleroy Note Added: 0005935
2011-05-29 12:10 xleroy Status confirmed => resolved
2011-05-29 12:10 xleroy Resolution open => fixed
2012-09-25 20:06 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker