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.
public PowerMultiple(
coefficient,
Multiple of (radix^power).
radix,
Radix (or base) of number.
exponent
Power (or exponent) of number.
)

PowerMultiple

#
public PowerMultiple(
reader
)

Properties

Absolute

#
Gets the absolute of this number.
public PowerMultiple Absolute { get; }

Coefficient

#
Gets the multiple of Radix^Power.
public BigInteger Coefficient { get; }

Exponent

#
Gets the power (or exponent) for this number.
public int Exponent { get; }

Inverse

#
Gets the inverse (one-over) of this number. This operation is usually approximate, but will attempt to find an exact solution up to 32 radix-orders-of-magnitude down from the implied inverse exponent.
public PowerMultiple Inverse { get; }

IsInteger

#
Gets whether this value represents a whole number.
public bool IsInteger { get; }

IsNegative

#
Gets whether this value is negative.
public bool IsNegative { get; }

IsOne

#
Gets whether this value is equal to one.
public bool IsOne { get; }

IsPositive

#
Gets whether this value is negative. Note that zero is not considered positive.
public bool IsPositive { get; }

IsZero

#
Gets whether this value is equal to zero.
public bool IsZero { get; }

MinusOne

#
Gets the negative one constant.
public static PowerMultiple MinusOne { get; }

Negative

#
Gets the negative of this number.
public PowerMultiple Negative { get; }

One

#
Gets the one constant.
public static PowerMultiple One { get; }

Radix

#
Gets the base of the power.
public int Radix { get; }

Sign

#
Gets the sign indicator -1 = negative, 0 = zero, +1 = positive.
public int Sign { get; }

Zero

#
Gets the zero constant.
public static PowerMultiple Zero { get; }

Methods

CompareTo

#
Compare two power multiples.
public int CompareTo()

DecimalPart

#
Return the decimal part of this number. This is basically the number minus the nearest smaller integer.
public PowerMultiple DecimalPart()

Expand

#
Decrease the exponent and raise the coefficient of this number without changing its magnitude.
public PowerMultiple Expand(
exponent
New exponent, must be smaller than or equal to the current exponent.
)
Expanded number.

FromFloatingPoint

#
Convert a floating point value into a power multiple.
public static PowerMultiple FromFloatingPoint(
number,
Value.
decimals,
Decimal places to consider.
radix
Radix base.
)
Power multiple representing the floating point number.

FromFloatingPoint

#
Convert a floating point value into a power multiple base 10.
public static PowerMultiple FromFloatingPoint(
number,
Value.
decimals
Decimal places to consider.
)
Power multiple representing the floating point number.

IntegralPart

#
Return the integral part of this number.
public PowerMultiple IntegralPart()

Rebase

#
Rebase this number. Note that this method will return approximate values under certain conditions.
public PowerMultiple Rebase(
radix
New radix.
)
Rebased number.

Reduce

#
Create the simplest possible version of this number, ie. using the highest possible power.
public PowerMultiple Reduce()

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.
public PowerMultiple Round(
digits
Number of digits.
)
Rounded number.

Store

#
public void Store(
writer
)
Store

ToDouble

#
Gets the double representation for this power multiple. Note that very large and very small powers fall outside the double numeric range.
public double ToDouble()
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.
public BigInteger ToInteger()
Integer representation of power multiple.

ToString

#
Returns a string that represents the current value.
public override string ToString()
A string that represents the current object.

ToString

#
Returns a string that represents the current value.
public string ToString(
integerFormat,
Formatter to use for integers.
doubleFormat
Formatter to use for non-integers.
)
A string that represents the current object.

TryParse

#
Try to convert a string representation back into a power multiple.
public static bool TryParse(
text,
String to convert.
pm
Power multiple on success.
)
True if string could be parsed.

Operators

OperationResultDescription
PowerMultiple+PowerMultiplePowerMultipleAdd two power multiples together. Multiples must share the same radix.
PowerMultiple/PowerMultiplePowerMultipleMultiply two power multiples together. Multiples must share the same radix.
PowerMultiple>PowerMultipleboolCompare two numbers for less-than.
PowerMultiple<PowerMultipleboolCompare two numbers for less-than.
PowerMultiple*PowerMultiplePowerMultipleMultiply two power multiples together. Multiples must share the same radix.
PowerMultiple-PowerMultiplePowerMultipleSubtract two power multiples. Multiples must share the same radix.
-PowerMultiplePowerMultipleCreate the negative of a power multiple.
+PowerMultiplePowerMultiplePositive indicator. This operator does nothing.

Convertors

OperationResultDescription
implicitBigIntegerPowerMultipleConvert a big integer into a power multiple.
implicitdoublePowerMultipleConvert 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.
implicitintPowerMultipleConvert an integer into a power multiple.
implicitlongPowerMultipleConvert a long integer into a power multiple.