Martin Desruisseaux ha scritto: > Andrea Aime a écrit : >> I've found various issues in IsEqualsToImpl as >> found in 2.3.x. The original implementation is attached, >> as well as a new implementation that should handle properly >> most numeric cases. >> The original implementation had various issues due to >> numeric overflows and decimal part truncations, and could >> not compare properly 5 and 5.0, for example. >> >> I've tried to build a better one, that I've attached >> along with the current one. >> Since this is a very central part of geotools I'd like >> to have a review or two before committing. > > I submit there an other proposal. The previous one had issues with the > usual corner cases (-0.0 vs +0.0 which are not equals according > Number.equals(Object),
Didn't know that > NaN values...). Forgot those indeed. > This proposal also try to avoid > some redundancies (e.g. looking twice the same object in the same > hashset) and try to work with arbitrary Number as long as they are > representable as long or double primitive type (so we do not cover > BigInteger / BigDecimal case, but at least we get ride of list of > special cases like SUPPORTED_NUMERIC hashset). > > In this proposal, the 'promote' method disaspear and 'parseToNumber' is > made private. I don't know when those method were introduced, so I don't > know if we are allowed to hide them. I added promote, as for making it private, no problem. I like your implementation, will merge it into 2.3.x. Thank you for taking the time and improve the proposal :-) Cheers Andrea ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
