BigDecimal.LongValueExact Method

Definition

Converts this BigDecimal to a long, checking for lost information.

[Android.Runtime.Register("longValueExact", "()J", "GetLongValueExactHandler")]
public virtual long LongValueExact ();
[<Android.Runtime.Register("longValueExact", "()J", "GetLongValueExactHandler")>]
abstract member LongValueExact : unit -> int64
override this.LongValueExact : unit -> int64

Returns

this BigDecimal converted to a long.

Attributes

Exceptions

if rounding is necessary or the number doesn't fit in a long.

Remarks

Converts this BigDecimal to a long, checking for lost information. If this BigDecimal has a nonzero fractional part or is out of the possible range for a long result then an ArithmeticException is thrown.

Added in 1.5.

Java documentation for java.math.BigDecimal.longValueExact().

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.

Applies to