Signed zeros: is this a bug?

Ben Finney bignose+hates-spam at benfinney.id.au
Mon Mar 12 23:32:51 CET 2007


aleax at mac.com (Alex Martelli) writes:

> This is not trivial to fix cleanly...:-(.  compiler_add_o would have
> to test "is the object I'm storing -0.0" (I don't even know how to
> do that in portable C...) and then do some kludge -- e.g. use as the
> key into the dict (-0.0, 0) instead of (-0.0, float) for this one
> special case.

Another way, which avoids making this decision, is to always store the
sign *and* value of the number as part of the key. I don't know if
that tradeoff is the right one though.

-- 
 \       "Our products just aren't engineered for security."  -- Brian |
  `\             Valentine, senior vice-president of Microsoft Windows |
_o__)                                                      development |
Ben Finney




More information about the Python-list mailing list