bilaldursun1 / nettopologysuite

Automatically exported from code.google.com/p/nettopologysuite
0 stars 0 forks source link

PrecisionModel doesn't round negative values correctly #145

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Class:
NetTopologySuite.Geometry.PrecisionModel

Method:
public double MakePrecise(double val)

Issue: I wanted to use the PrecisionModel to compare my Geometries. But the 
method "MakePrecise" doesn't round negative values correctly.

Example:
Input: -10, Scale: 1
Expected Output: -10
Output (Current): -9

To Fix: change Line: 361 in \NetTopologySuite\Geometry\PrecisionModel.cs
Current: return Math.Floor(((val * _scale) + 0.5d)) / _scale;
Solution: return Math.Round(((val * _scale))) / _scale;

Original issue reported on code.google.com by balz.ste...@gmail.com on 25 Mar 2013 at 1:33

GoogleCodeExporter commented 9 years ago
Thanks for bringing this to our attention. Should be fixed with r1034.

Original comment by felix.ob...@netcologne.de on 2 Apr 2013 at 9:29