Condividi tramite


BigDecimal.ValueOf Method

Definition

Overloads

ValueOf(Int64)

Translates a long to a BigDecimal.

ValueOf(Int64, Int32)

Translates a long to a BigDecimal with a given scale.

ValueOf(Double)

Translates a double to a BigDecimal.

ValueOf(Int64)

Translates a long to a BigDecimal.

[Android.Runtime.Register("valueOf", "(J)Landroid/icu/math/BigDecimal;", "", ApiSince=24)]
public static Android.Icu.Math.BigDecimal? ValueOf (long lint);
[<Android.Runtime.Register("valueOf", "(J)Landroid/icu/math/BigDecimal;", "", ApiSince=24)>]
static member ValueOf : int64 -> Android.Icu.Math.BigDecimal

Parameters

lint
Int64

The long to be translated.

Returns

The BigDecimal equal in value to lint.

Attributes

Remarks

Translates a long to a BigDecimal. That is, returns a plain BigDecimal whose value is equal to the given long.

Java documentation for android.icu.math.BigDecimal.valueOf(long).

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

ValueOf(Int64, Int32)

Translates a long to a BigDecimal with a given scale.

[Android.Runtime.Register("valueOf", "(JI)Landroid/icu/math/BigDecimal;", "", ApiSince=24)]
public static Android.Icu.Math.BigDecimal? ValueOf (long lint, int scale);
[<Android.Runtime.Register("valueOf", "(JI)Landroid/icu/math/BigDecimal;", "", ApiSince=24)>]
static member ValueOf : int64 * int -> Android.Icu.Math.BigDecimal

Parameters

lint
Int64

The long to be translated.

scale
Int32

The int scale to be applied.

Returns

The BigDecimal equal in value to lint.

Attributes

Remarks

Translates a long to a BigDecimal with a given scale. That is, returns a plain BigDecimal whose unscaled value is equal to the given long, adjusted by the second parameter, scale.

The result is given by:

(new BigDecimal(lint)).divide(TEN.pow(new BigDecimal(scale)))

A NumberFormatException is thrown if scale is negative.

Java documentation for android.icu.math.BigDecimal.valueOf(long, int).

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

ValueOf(Double)

Translates a double to a BigDecimal.

[Android.Runtime.Register("valueOf", "(D)Landroid/icu/math/BigDecimal;", "", ApiSince=24)]
public static Android.Icu.Math.BigDecimal? ValueOf (double dub);
[<Android.Runtime.Register("valueOf", "(D)Landroid/icu/math/BigDecimal;", "", ApiSince=24)>]
static member ValueOf : double -> Android.Icu.Math.BigDecimal

Parameters

dub
Double

The double to be translated.

Returns

The BigDecimal equal in value to dub.

Attributes

Remarks

Translates a double to a BigDecimal.

Returns a BigDecimal which is the decimal representation of the 64-bit signed binary floating point parameter. If the parameter is infinite, or is not a number (NaN), a NumberFormatException is thrown.

The number is constructed as though num had been converted to a String using the Double.toString() method and the #BigDecimal(java.lang.String) constructor had then been used. This is typically not an exact conversion.

Java documentation for android.icu.math.BigDecimal.valueOf(double).

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