Package ptolemy.math

Examples of ptolemy.math.FixPoint


     *  that the type of the argument is an FixToken.
     *  @param rightArgument The token to add to this token.
     *  @return A new FixToken containing the result.
     */
    protected ScalarToken _add(ScalarToken rightArgument) {
        FixPoint result = _value.add(((FixToken) rightArgument).fixValue());
        return new FixToken(result);
    }
View Full Code Here


     *  the type of the argument is an FixToken
     *  @param rightArgument The token to divide this token by.
     *  @return A new FixToken containing the result.
     */
    protected ScalarToken _divide(ScalarToken rightArgument) {
        FixPoint result = _value.divide(((FixToken) rightArgument).fixValue());
        return new FixToken(result);
    }
View Full Code Here

     @param rightArgument The token to divide this token by.
     *  @param quant The quantization specification.
     *  @return A new FixToken containing the result.
     */
    protected ScalarToken _divide(ScalarToken rightArgument, Quantization quant) {
        FixPoint result = _value.divide(((FixToken) rightArgument).fixValue(),
                quant);
        return new FixToken(result);
    }
View Full Code Here

     *  the type of the argument is an FixToken.
     *  @param rightArgument The token to multiply this token by.
     *  @return A new FixToken containing the result.
     */
    protected ScalarToken _multiply(ScalarToken rightArgument) {
        FixPoint result = _value
                .multiply(((FixToken) rightArgument).fixValue());
        return new FixToken(result);
    }
View Full Code Here

     *  with a quantization specification.
     *  @param quant The quantization specification.
     *  @return A new FixToken containing the result.
     */
    protected FixToken _quantize(Quantization quant) {
        FixPoint result = _value.quantize(quant);
        return new FixToken(result);
    }
View Full Code Here

     *  the type of the argument is an FixToken.
     *  @param rightArgument The token to subtract from this token.
     *  @return A new FixToken containing the result.
     */
    protected ScalarToken _subtract(ScalarToken rightArgument) {
        FixPoint result = _value
                .subtract(((FixToken) rightArgument).fixValue());
        return new FixToken(result);
    }
View Full Code Here

    /** Return the value in the token as a fixpoint.
     *  @return The value contained in this token as a fixpoint.
     */
    public FixPoint fixValue() {
        // FIXME: Does FixPoint need to specially handle Short?
        return new FixPoint(_value);
    }
View Full Code Here

                    localName, stringTokenClass, stringTokenConstructor,
                    StringConstant.v(((StringToken) token).stringValue()));
            return tokenLocal;
        } else if (token instanceof FixToken) {
            FixToken fixToken = (FixToken) token;
            FixPoint fixValue = fixToken.fixValue();
            List args = new ArrayList(3);

            // Some possible loss of precision?
            args.add(DoubleConstant.v(fixValue.doubleValue()));
            args.add(IntConstant.v(fixValue.getPrecision().getNumberOfBits()));
            args.add(IntConstant.v(fixValue.getPrecision()
                    .getIntegerBitLength()));

            Local tokenLocal = _buildConstantTokenLocal(body, insertPoint,
                    localName, fixTokenClass, fixTokenThreeArgConstructor, args);
            return tokenLocal;
View Full Code Here

            if (!address.hasToken(0)) {
                return;
            }

            FixToken addressToken = (FixToken) address.get(0);
            FixPoint addressFixValue = addressToken.fixValue();

            _checkFixTokenWidth(addressToken, _addressWidth);

            addressValue = addressFixValue.getUnscaledValue().intValue();

            if (addressValue >= _capacity) {
                throw new IllegalActionException(this,
                        "Address is out of range.");
            }

            ArrayToken valuesArray = (ArrayToken) values.getToken();
            FixPoint value = new FixPoint(((ScalarToken) valuesArray
                    .getElement(addressValue)).intValue());
            Token result = new FixToken(value);
            if (result == null) {
                result = Token.NIL;
            }
View Full Code Here

        }

        //FIXME: what do we do if input is negative?
        //bits = bits.replace('-', '1');

        FixPoint result = new FixPoint(new BigDecimal(new BigInteger(bits
                .toString(), 2)), new FixPointQuantization(precision, overflow,
                rounding));

        sendOutput(output, 0, new FixToken(result));
    }
View Full Code Here

TOP

Related Classes of ptolemy.math.FixPoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.