Пример #1
0
 public static IntToken bitwidth(Term term, TermContext context) {
   if (term instanceof BitVector) {
     return IntToken.of(((BitVector) term).bitwidth());
   } else {
     Integer bitwidth = BitVector.getBitwidth(term);
     if (bitwidth == null) {
       return null;
     }
     return IntToken.of(bitwidth);
   }
 }
Пример #2
0
 public static IntToken uvalue(BitVector term, TermContext context) {
   return IntToken.of(term.unsignedValue());
 }
 public static IntToken exponentBits(FloatToken term, TermContext context) {
   return IntToken.of(term.exponent());
 }
 public static IntToken exponent(FloatToken term, TermContext context) {
   BinaryMathContext mc = getMathContext(term);
   return IntToken.of(term.bigFloatValue().exponent(mc.minExponent, mc.maxExponent));
 }
 public static IntToken precision(FloatToken term, TermContext context) {
   return IntToken.of(term.bigFloatValue().precision());
 }
 /**
  * Rounds {@code term} to an integer by truncating it. Function is only defined on ordinary
  * numbers (i.e. not NaN or infinity).
  */
 public static IntToken float2int(FloatToken term, TermContext context) {
   return IntToken.of(
       term.bigFloatValue()
           .rint(getMathContext(term).withRoundingMode(RoundingMode.DOWN))
           .toBigIntegerExact());
 }