1

I am using the Java API of Z3 and I need to define integer variables which are natural i.e. their value cannot be negative. How can I define natural data type in z3 using java API?

Mike Laren
  • 8,028
  • 17
  • 51
  • 70
Mahsa
  • 31
  • 2
  • See this answer: http://stackoverflow.com/questions/23192058/z3-java-api-documentation-or-tutorial – scottb Jun 16 '15 at 17:41

1 Answers1

0

It depends on the version of Java. Pre-Java 8 you have to roll your own type, often by using larger primitives so you can represent the entire range of an unsigned value at the bit-length you require.

This (may) require doing your own two's complement math.

Java 8 has a new Unsigned Integer API, which offer a much easier way of manipulating values in a truly unsigned manner. See the API docs for Integer.

  • 1
    Another pre-Java 8 option to consider is also the [Guava's `UnsignedInteger`](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/primitives/UnsignedInteger.html) – BackSlash Jul 12 '15 at 19:21