org.opengis.geometry

## Interface Precision

• ### Method Summary

All Methods
Modifier and Type Method and Description
`int` `compareTo(Precision other)`
Compares this precision model with the specified one.
`double` `getScale()`
Multiplying factor used to obtain a precise ordinate.
`PrecisionType` `getType()`
Returns the type of this precision model.
`void` `round(DirectPosition position)`
Rounds a direct position to this precision model in place.
• ### Method Detail

• #### compareTo

`int compareTo(Precision other)`
Compares this precision model with the specified one. Returns -1 is this model is less accurate than the other one, +1 if it is more accurate, or 0 if they have the same accuracy.
Specified by:
`compareTo` in interface `Comparable<Precision>`
Parameters:
`other` - Other precision model to compare against.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the other.
• #### getScale

`double getScale()`
Multiplying factor used to obtain a precise ordinate.

Multiply by this value and then divide by this value to round correctly:

``` double scale = pm.getScale();
return Math.round(value * scale) / scale;
```
So to round to `3` significant digits we would have a scale of `1000`. Tip: the number of significant digits can be computed as below:
``` int significantDigits = (int) Math.ceil(Math.log10(pm.getScale()));
```
Returns:
Multiplying factor used before rounding.
• #### getType

`PrecisionType getType()`
Returns the type of this precision model.
• #### round

`void round(DirectPosition position)`
Rounds a direct position to this precision model in place.

It is likely that a `Precision` instance will keep different rounding rules for different axis (example x & y ordinates may be handled differently then height), by always rounding a direct position as a whole we will enable this functionality.

Copyright © 1996–2021 Geotools. All rights reserved.