|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.data.expr.FixPointFunctions
public class FixPointFunctions
This class provides static functions for operating on Fixpoint numbers in the Ptolemy II expression language. The added functionality is
fix(5.34, 10, 4)creates a fixed point number with a total of 10 bits, 4 of which are integer bits, representing the number 5.34.
fix([ -.040609, -.001628, .17853, .37665, .37665, .17853, -.001628, -.040609 ], 10, 2)creates a matrix where each entry has 10 bits, two of which are integer bits.
quantize(5.34, 10, 4)quantizes the number 5.34 to 10 bits of precision, 4 of which are integer bits.
quantize([ -.040609, -.001628, .17853, .37665, .37665, .17853, -.001628, -.040609 ], 10, 2)creates a new instance of DoubleMatrixToken containing the specified values with 10 bits of precision, two of which are integer bits.
PtParser,
FixPoint,
Quantizer
| Red (kienhuis) |
| Yellow (kienhuis) |
| Constructor Summary | |
|---|---|
private |
FixPointFunctions()
|
| Method Summary | |
|---|---|
static FixPoint |
fix(double value,
int numberOfBits,
int integerBits)
Create a FixPoint representing the specified double. |
static FixPoint |
fix(int value,
int numberOfBits,
int integerBits)
Create a FixPoint representing the specified integer. |
static double |
quantize(double value,
int numberOfBits,
int integerBits)
Create a double whose value is the quantized version of the given double value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
private FixPointFunctions()
| Method Detail |
|---|
public static FixPoint fix(int value,
int numberOfBits,
int integerBits)
fix(5, 10, 4)
creates a fixed point representation of the integer 5 with
10 bits of precision, 4 of which are integer bits.
value - The value to represent.numberOfBits - The total number of bits.integerBits - The number of bits used for the integer part.
public static FixPoint fix(double value,
int numberOfBits,
int integerBits)
fix(5.34, 10, 4)
creates a fixed point representation of the numer 5.34 with
10 bits of precision, 4 of which are integer bits.
value - The value to represent.numberOfBits - The total number of bits.integerBits - The number of bits used for the integer part.
public static double quantize(double value,
int numberOfBits,
int integerBits)
quantize(5.34, 10, 4)
yields a double representing 5.34 quantized to 10 bits of
precision, of which 4 bits are used
for the integer part and 6 bits are used for the fractional
part.
value - The value to quantize.numberOfBits - The total number of bits.integerBits - The number of bits used for the integer part.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||