/*++ Copyright (c) 2012 Microsoft Corporation Module Name: AlgebraicNum.cs Abstract: Z3 Managed API: Algebraic Numerals Author: Christoph Wintersteiger (cwinter) 2012-03-20 Notes: --*/ using System.Diagnostics; using System; #if !FRAMEWORK_LT_4 using System.Numerics; #endif namespace Microsoft.Z3 { /// /// Algebraic numbers /// public class AlgebraicNum : ArithExpr { /// /// Return a upper bound for a given real algebraic number. /// The interval isolating the number is smaller than 1/10^. /// /// /// the precision of the result /// A numeral Expr of sort Real public RatNum ToUpper(uint precision) { return new RatNum(Context, Native.Z3_get_algebraic_number_upper(Context.nCtx, NativeObject, precision)); } /// /// Return a lower bound for the given real algebraic number. /// The interval isolating the number is smaller than 1/10^. /// /// /// /// A numeral Expr of sort Real public RatNum ToLower(uint precision) { return new RatNum(Context, Native.Z3_get_algebraic_number_lower(Context.nCtx, NativeObject, precision)); } /// /// Returns a string representation in decimal notation. /// /// The result has at most decimal places. public string ToDecimal(uint precision) { return Native.Z3_get_numeral_decimal_string(Context.nCtx, NativeObject, precision); } #region Internal internal AlgebraicNum(Context ctx, IntPtr obj) : base(ctx, obj) { Debug.Assert(ctx != null); } #endregion } }