SignificantDigitsNumberRounder
SignificantDigitsNumberRounder
SignificantDigitsNumberRounder
SignificantDigitsNumberRounder
Class
Definition
Rounds numbers to a specified number of significant digits.
public : sealed class SignificantDigitsNumberRounder : INumberRounder, ISignificantDigitsNumberRounderpublic sealed class SignificantDigitsNumberRounder : INumberRounder, ISignificantDigitsNumberRounderPublic NotInheritable Class SignificantDigitsNumberRounder Implements INumberRounder, ISignificantDigitsNumberRounder// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Constructors
SignificantDigitsNumberRounder() SignificantDigitsNumberRounder() SignificantDigitsNumberRounder() SignificantDigitsNumberRounder()
Creates a SignificantDigitsNumberRounder object.
This constructor initializes RoundingAlgorithm to a default value of RoundingAlgorithm.**RoundHalfUp**, and SignificantDigits to 0.
public : SignificantDigitsNumberRounder()public SignificantDigitsNumberRounder()Public Sub New()// You can use this method in JavaScript.
Properties
RoundingAlgorithm RoundingAlgorithm RoundingAlgorithm RoundingAlgorithm
Gets or sets the rounding strategy value for this SignificantDigitsNumberRounder object.
public : RoundingAlgorithm RoundingAlgorithm { get; set; }public RoundingAlgorithm RoundingAlgorithm { get; set; }Public ReadWrite Property RoundingAlgorithm As RoundingAlgorithm// You can use this property in JavaScript.
A value of the RoundingAlgorithm enumeration.
Remarks
This property is initialized to a default value of RoundingAlgorithm.**RoundHalfUp**.
SignificantDigits SignificantDigits SignificantDigits SignificantDigits
Gets or sets the number of significant digits this SignificantDigitsNumberRounder object uses for rounding.
public : unsigned int SignificantDigits { get; set; }public uint SignificantDigits { get; set; }Public ReadWrite Property SignificantDigits As uint// You can use this property in JavaScript.
- Value
- unsigned int uint uint uint
The number of significant digits used for rounding.
Remarks
This property is initialized to a default value of 1.
If this property is 0, no rounding is performed by the SignificantDigitsNumberRounder object.
When rounding is performed, leading 0s in the input are not considered. Significant digits are counted beginning with the first non-zero digit until the number of SignificantDigits occurs, and then RoundingAlgorithm is used to round at that position.
Methods
RoundDouble(Double) RoundDouble(Double) RoundDouble(Double) RoundDouble(Double)
Rounds a Double number to the specified number of significant digits.
public : double RoundDouble(double value)public double RoundDouble(Double value)Public Function RoundDouble(value As Double) As double// You can use this method in JavaScript.
- value
- double Double Double Double
The Double value to be rounded.
The rounded number. This result is a double precision floating point number, which is not necessarily an integer.
Remarks
The rounding strategy is based on the values of SignificantDigits and RoundingAlgorithm.
Note
This method is precise only within the limits of the Double data type: approximately 15 digits.
RoundInt32(Int32) RoundInt32(Int32) RoundInt32(Int32) RoundInt32(Int32)
Rounds an Int32 number to the specified number of significant digits.
public : int RoundInt32(int value)public int RoundInt32(Int32 value)Public Function RoundInt32(value As Int32) As int// You can use this method in JavaScript.
- value
- int Int32 Int32 Int32
The Int32 value to be rounded.
The rounded 32 bit integer.
Remarks
The rounding strategy is based on the values of SignificantDigits and RoundingAlgorithm.
RoundInt64(Int64) RoundInt64(Int64) RoundInt64(Int64) RoundInt64(Int64)
Rounds an Int64 number to the specified number of significant digits.
public : long RoundInt64(long value)public long RoundInt64(Int64 value)Public Function RoundInt64(value As Int64) As long// You can use this method in JavaScript.
- value
- long Int64 Int64 Int64
The Int64 value to be rounded.
The rounded 64 bit integer.
Remarks
The rounding strategy is based on the values of SignificantDigits and RoundingAlgorithm.
RoundSingle(Single) RoundSingle(Single) RoundSingle(Single) RoundSingle(Single)
Rounds a Single number to the specified number of significant digits.
public : float RoundSingle(float value)public float RoundSingle(Single value)Public Function RoundSingle(value As Single) As float// You can use this method in JavaScript.
- value
- float Single Single Single
The Single value to be rounded.
The rounded number. This result is a single precision floating point number, which is not necessarily an integer.
Remarks
The rounding strategy is based on the values of SignificantDigits and RoundingAlgorithm.
Note
This method is precise only within the limits of the Single data type: approximately 7 digits.
RoundUInt32(UInt32) RoundUInt32(UInt32) RoundUInt32(UInt32) RoundUInt32(UInt32)
Rounds a UInt32 number to the specified number of significant digits.
public : unsigned int RoundUInt32(unsigned int value)public uint RoundUInt32(UInt32 value)Public Function RoundUInt32(value As UInt32) As uint// You can use this method in JavaScript.
- value
- unsigned int UInt32 UInt32 UInt32
The UInt32 value to be rounded.
The rounded unsigned 32 bit integer.
Remarks
The rounding strategy is based on the values of SignificantDigits and RoundingAlgorithm.
RoundUInt64(UInt64) RoundUInt64(UInt64) RoundUInt64(UInt64) RoundUInt64(UInt64)
Rounds a UInt64 number to the specified number of significant digits.
public : ulong RoundUInt64(unsigned __int64 value)public ulong RoundUInt64(UInt64 value)Public Function RoundUInt64(value As UInt64) As ulong// You can use this method in JavaScript.
- value
- unsigned __int64 UInt64 UInt64 UInt64
The UInt64 value to be rounded.
The rounded unsigned 64 bit integer.
Remarks
The rounding strategy is based on the values of SignificantDigits and RoundingAlgorithm.