PowerMultiple
References[IoId("00000000-AE93-48D3-8C0B-0D2EA0ADE15A")]
public struct PowerMultiple : IComparable<PowerMultiple>, IStorable
Represents an immutable number defined as the multiple of some power.
Constructors
PowerMultiple
#Create a new power multiple.
Parameters:
| coefficient (BigInteger) | Multiple of (radix^power). |
| radix (int) | Radix (or base) of number. |
| exponent (int) | Power (or exponent) of number. |
Properties
Methods
DecimalPart
#Return the decimal part of this number. This is basically the number minus the nearest smaller integer.
Expand
#Decrease the exponent and raise the coefficient of this number without changing its magnitude.
Parameters:
| exponent (int) | New exponent, must be smaller than or equal to the current exponent. |
Returns: Expanded number.
Rebase
#Rebase this number. Note that this method will return approximate values under certain conditions.
Parameters:
| radix (int) | New radix. |
Returns: Rebased number.
Round
#Round this number down to a fixed number of significant coefficient digits. Rounding is only exact if the Radix equals 10, otherwise some inaccuracies will be introduced.
Parameters:
| digits (int) | Number of digits. |
Returns: Rounded number.
ToDouble
#Gets the double representation for this power multiple. Note that very large and very small powers fall outside the double numeric range.
Returns: Double representation of power multiple.
ToInteger
#Gets the integer representation for this power multiple. If this multiple cannot be represented by an exact integer, an approximate value is returned.
Returns: Integer representation of power multiple.
ToString
#Returns a string that represents the current value.
Returns: A string that represents the current object.
Overrides: ValueType.ToString
ToString
#Returns a string that represents the current value.
Parameters:
| integerFormat (NumberFormat) | Formatter to use for integers. |
| doubleFormat (NumberFormat) | Formatter to use for non-integers. |
Returns: A string that represents the current object.
TryParse
#Try to convert a string representation back into a power multiple.
Parameters:
| text (string) | String to convert. |
| pm (out PowerMultiple) | Power multiple on success. |
Returns: True if string could be parsed.
Operators
| Operation | Result | Description | ||
|---|---|---|---|---|
| PowerMultiple | + | PowerMultiple | PowerMultiple | Add two power multiples together. Multiples must share the same radix. |
| PowerMultiple | / | PowerMultiple | PowerMultiple | Multiply two power multiples together. Multiples must share the same radix. |
| PowerMultiple | > | PowerMultiple | bool | Compare two numbers for less-than. |
| PowerMultiple | < | PowerMultiple | bool | Compare two numbers for less-than. |
| PowerMultiple | * | PowerMultiple | PowerMultiple | Multiply two power multiples together. Multiples must share the same radix. |
| PowerMultiple | - | PowerMultiple | PowerMultiple | Subtract two power multiples. Multiples must share the same radix. |
| - | PowerMultiple | PowerMultiple | Create the negative of a power multiple. | |
| + | PowerMultiple | PowerMultiple | Positive indicator. This operator does nothing. | |
Convertors
| Operation | Result | Description | ||
|---|---|---|---|---|
| implicit | BigInteger | PowerMultiple | Convert a big integer into a power multiple. | |
| implicit | double | PowerMultiple | Convert a double precision floating point number into a power multiple. This automatic converter assumes six decimal places of accuracy, if you want custom control over the accuracy, use the FromFloatingPoint() method. | |
| implicit | int | PowerMultiple | Convert an integer into a power multiple. | |
| implicit | long | PowerMultiple | Convert a long integer into a power multiple. | |