public static FloatToken int2float( IntToken term, IntToken precision, IntToken exponent, TermContext context) { return FloatToken.of( new BigFloat( term.bigIntegerValue(), new BinaryMathContext(precision.intValue(), exponent.intValue())), exponent.intValue()); }
public static BuiltinList toDigits( BitVector term, IntToken bitwidth, IntToken count, TermContext context) { if (bitwidth.intValue() > 0 && bitwidth.intValue() * count.intValue() <= term.bitwidth) { BuiltinList.Builder builder = BuiltinList.builder(context); builder.addItems(term.toDigits(bitwidth.intValue(), count.intValue())); return (BuiltinList) builder.build(); } else { return null; } }
/** * Rounds {@code term} to the specfiied precision and exponent range. * * <p>Method is undefined if either integer is less than 2 because 2 is the minimum precision and * exponent. Two exponents must be used to store zero/subnormal/infinity/nan, so 4 is the minimum * number of distinct exponents a float can have. MPFR does not support floats with 1 bit of * precision. bits of the float. */ public static FloatToken round( FloatToken term, IntToken precision, IntToken exponent, TermContext context) { if (precision.intValue() < 2 || exponent.intValue() < 2) { return null; } return FloatToken.of( term.bigFloatValue() .round(new BinaryMathContext(precision.intValue(), exponent.intValue())), exponent.intValue()); }
public static BitVector construct(IntToken bitwidth, IntToken value, TermContext context) { try { return BitVector.of(value.bigIntegerValue(), bitwidth.intValue()); } catch (ArithmeticException e) { throw new IllegalArgumentException(e); } }
public void initialize() throws IllegalActionException { super.initialize(); IntToken it = (IntToken) LS0Bytes.getToken(); _LS0Bytes = it.intValue(); BooleanToken _bt = (BooleanToken) LS0Map.getToken(); _LS0Map = _bt.booleanValue(); it = (IntToken) S.getToken(); _S = it.intValue(); _fastReg = 0; _interReg = 0; _frameCounter = 0; _checkParameters(); }
public static BitVector extract( BitVector term, IntToken beginIndex, IntToken endIndex, TermContext context) { return term.extract(beginIndex.intValue(), endIndex.intValue()); }
public static FloatToken minValue( IntToken precision, IntToken exponentBits, TermContext context) { BinaryMathContext mc = new BinaryMathContext(precision.intValue(), exponentBits.intValue()); return FloatToken.of(BigFloat.minValue(mc.precision, mc.minExponent), exponentBits.intValue()); }
public static FloatToken root(FloatToken term1, IntToken term2, TermContext context) { return FloatToken.of( term1.bigFloatValue().root(term2.intValue(), getMathContext(term1)), term1.exponent()); }