0
0
mirror of https://github.com/zeux/pugixml.git synced 2025-01-14 18:07:59 +08:00

Added round_nearest_nzero explanation

git-svn-id: http://pugixml.googlecode.com/svn/trunk@462 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
arseny.kapoulkine 2010-05-29 13:12:46 +00:00
parent f262cbb6be
commit d3419f2f4b

View File

@ -444,6 +444,7 @@ namespace
double round_nearest_nzero(double value)
{
// same as round_nearest, but returns -0 for [-0.5, -0]
// ceil is used to differentiate between +0 and -0 (we return -0 for [-0.5, -0] and +0 for +0)
return (value >= -0.5 && value <= 0) ? ceil(value) : floor(value + 0.5);
}