A precision model defines a grid of allowable points. The {@link #round} methodallows to round a direct position to the nearest allowed point. The {@link #getType}method describes the collapsing behavior of a direct position.
{@code Precision} instances can be sorted by their {@linkplain #getScale scale}.
@author Jody Garnett @since GeoAPI 2.1 @source $URL$Signed fixed point formats are represented in a 2's complement format. As a consequence, a single bit is used to represent the sign of the number. The value of a multi-bit signed number is:
Signed(B) = 2^m x (- b_{n-1} x 2^{n-1} + \sum_{i=0}^{n-2} b_i x 2^i), where b_i is the value of bit i of the bit vector.
Unsigned fixed formats are represented as unsigned binary values. No bits are used to represent the sign and all values are positive. The actual value of a multi-bit unsigned fixed point number is:
Unsigned(B) = 2^m x (\sum_{i=0}^{n-1} b_i x 2^i)
This class supports several different String formats for specifying and displaying the Precision. These String formats are supported by several classes that extend the {@link PrecisionFormat} class. Several such classeshave been created. Any given precision string format can be represented in any of the valid precision string formats. The four supported Precision String formats are shown in the table below. A static singleton object of each of these formats is provided in this class. Each String Representation column of the table represent equivalent Precision formats:
Format Name | Format Spec | ||||||
{@link IntegerFractionPrecisionFormat} | [integer bits].[fraction bits] | 3.2 | 0.7 | -2.12 | 12.-4 | 32.0 | U1.7 |
{@link LengthIntegerPrecisionFormat} | [total bits]/[integer bits] | 5/3 | 7/0 | 10/-2 | 8/12 | 32/32 | U8/1 |
{@link VHDLPrecisionFormat} | [MSb position]:[LSb position] | 2:-2 | -1:-7 | -3:-12 | 11:4 | 31:0 | U0:-7 |
{@link LengthExponentPrecisionFormat} | \[total bits]e[binary point position] | 5e-2 | 7e-7 | 10e-12 | 8e4 | 32e0 | U8e-7 |
An instance of the class is immutable, meaning that its value is set in the constructor and cannot then be modified. @author Bart Kienhuis, Contributor: Mike Wirthlin @version $Id: Precision.java,v 1.73 2007/12/06 21:57:08 cxh Exp $ @since Ptolemy II 0.4 @Pt.ProposedRating Yellow (kienhuis) @Pt.AcceptedRating Red (kienhuis) @see FixPoint
|
|