MathContext Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The MathContext
immutable class encapsulates the
settings understood by the operator methods of the BigDecimal
class (and potentially other classes).
[Android.Runtime.Register("android/icu/math/MathContext", ApiSince=24, DoNotGenerateAcw=true)]
public sealed class MathContext : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISerializable
[<Android.Runtime.Register("android/icu/math/MathContext", ApiSince=24, DoNotGenerateAcw=true)>]
type MathContext = class
inherit Object
interface ISerializable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
- Inheritance
- Attributes
- Implements
Remarks
The MathContext
immutable class encapsulates the settings understood by the operator methods of the BigDecimal
class (and potentially other classes). Operator methods are those that effect an operation on a number or a pair of numbers.
The settings, which are not base-dependent, comprise: <ol> <li>digits
: the number of digits (precision) to be used for an operation <li>form
: the form of any exponent that results from the operation <li>lostDigits
: whether checking for lost digits is enabled <li>roundingMode
: the algorithm to be used for rounding. </ol>
When provided, a MathContext
object supplies the settings for an operation directly.
When MathContext.DEFAULT
is provided for a MathContext
parameter then the default settings are used (9, SCIENTIFIC, false, ROUND_HALF_UP
).
In the BigDecimal
class, all methods which accept a MathContext
object defaults) also have a version of the method which does not accept a MathContext parameter. These versions carry out unlimited precision fixed point arithmetic (as though the settings were (0, PLAIN, false, ROUND_HALF_UP
).
The instance variables are shared with default access (so they are directly accessible to the BigDecimal
class), but must never be changed.
The rounding mode constants have the same names and values as the constants of the same name in java.math.BigDecimal
, to maintain compatibility with earlier versions of BigDecimal
.
Java documentation for android.icu.math.MathContext
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
MathContext(Int32, MathNotationForm, Boolean, RoundOptions) |
Constructs a new |
MathContext(Int32, MathNotationForm, Boolean) |
Constructs a new |
MathContext(Int32, MathNotationForm) |
Constructs a new |
MathContext(Int32) |
Constructs a new |
Fields
Engineering |
Obsolete.
Standard floating point notation (with engineering exponential format, where the power of ten is a multiple of 3). |
Plain |
Obsolete.
Plain (fixed point) notation, without any exponent. |
RoundCeiling |
Obsolete.
Rounding mode to round to a more positive number. |
RoundDown |
Obsolete.
Rounding mode to round towards zero. |
RoundFloor |
Obsolete.
Rounding mode to round to a more negative number. |
RoundHalfDown |
Obsolete.
Rounding mode to round to nearest neighbor, where an equidistant value is rounded down. |
RoundHalfEven |
Obsolete.
Rounding mode to round to nearest neighbor, where an equidistant value is rounded to the nearest even neighbor. |
RoundHalfUp |
Obsolete.
Rounding mode to round to nearest neighbor, where an equidistant value is rounded up. |
RoundUnnecessary |
Obsolete.
Rounding mode to assert that no rounding is necessary. |
RoundUp |
Obsolete.
Rounding mode to round away from zero. |
Scientific |
Obsolete.
Standard floating point notation (with scientific exponential format, where there is one digit before any decimal point). |
Properties
Class |
Returns the runtime class of this |
Default |
A |
Digits |
Returns the digits setting. |
Form |
Returns the form setting. |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
LostDigits |
Returns the lostDigits setting. |
PeerReference | (Inherited from Object) |
RoundingMode |
Returns the roundingMode setting. |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
Methods
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |