how to write hash function for double

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Mon Jun 24 18:22:57 AEST 1991


In article <67790003 at hpcupt1.cup.hp.com>, thomasw at hpcupt1.cup.hp.com (Thomas Wang) writes:
> The question is whether there can be two different bit patterns of double
> that represented the same double number?

It depends on which machine you are using.  On a machine with IEEE arithmetic,
do you want to consider -0.0 and +0.0 "the same"?  (== must, but they behave
differently.)  On an IBM mainframe, there are a great many bit patterns
corresponding to the name number.  On a VAX (except for there being two
different kinds of "double") you are ok.

Converting to text is not a good idea; it is relatively expensive and it
isn't always as accurate as it should be.

-- 
I agree with Jim Giles about many of the deficiencies of present UNIX.



More information about the Comp.lang.c mailing list