3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-20 20:05:51 +00:00

Add numeral extraction helpers to Java API

New methods:
- Expr.getNumeralDouble(): retrieve any numeral as a double
- IntNum.getUint(): extract numeral as unsigned 32-bit value
- IntNum.getUint64(): extract numeral as unsigned 64-bit value
- RatNum.getSmall(): numerator/denominator as int64 pair
- RatNum.getRationalInt64(): numerator/denominator (returns null on overflow)

Each is a thin wrapper around the existing Native binding.
Added examples to JavaExample.java covering all new methods.
This commit is contained in:
Angelica Moreira 2026-03-14 20:59:11 +00:00
parent cb13fa2325
commit 602932e3d1
4 changed files with 125 additions and 1 deletions

View file

@ -244,6 +244,15 @@ public class Expr<R extends Sort> extends AST
return Native.isNumeralAst(getContext().nCtx(), getNativeObject());
}
/**
* Return the numeral value as a double.
* The expression must be a numeral or an algebraic number.
**/
public double getNumeralDouble()
{
return Native.getNumeralDouble(getContext().nCtx(), getNativeObject());
}
/**
* Indicates whether the term is well-sorted.
*