public struct BigQueryBigNumeric : IEquatable<BigQueryBigNumeric>, IComparable<BigQueryBigNumeric>, IComparable
Representation of the BigQuery BIGNUMERIC type, which has 76 digits of precision (plus a leftmost partial digit), and a fixed scale of 38 decimal places to the right of the decimal point. This is the same as to say that the type supports 38 full digits and a partial 39th digit before the decimal point and 38 digits after the decimal point. The supported value range is exactly -2^255e-38 to (2^255 - 1)e-38.
Namespace
Google.Cloud.BigQuery.V2Assembly
Google.Cloud.BigQuery.V2.dll
Properties
Epsilon
public static readonly BigQueryBigNumeric Epsilon { get; }
The smallest positive value for BigQueryBigNumeric, equal to 1e-38.
Property Value | |
---|---|
Type | Description |
BigQueryBigNumeric |
MaxValue
public static readonly BigQueryBigNumeric MaxValue { get; }
The maximum valid value for BigQueryBigNumeric, equal to (2^255 - 1)e-38.
Property Value | |
---|---|
Type | Description |
BigQueryBigNumeric |
MinValue
public static readonly BigQueryBigNumeric MinValue { get; }
The minimum valid value for BigQueryBigNumeric, equal to -2^255e-38.
Property Value | |
---|---|
Type | Description |
BigQueryBigNumeric |
Zero
public static readonly BigQueryBigNumeric Zero { get; }
Zero represented as a BigQueryBigNumeric. This is the default value for the type.
Property Value | |
---|---|
Type | Description |
BigQueryBigNumeric |
Methods
CompareTo(BigQueryBigNumeric)
public int CompareTo(BigQueryBigNumeric other)
Compares this value with other
.
Parameter | |
---|---|
Name | Description |
other | BigQueryBigNumeric The value to compare with this one |
Returns | |
---|---|
Type | Description |
Int32 | A negative integer if this value is less than |
GetHashCode()
public override int GetHashCode()
Returns a hash code for this value.
Returns | |
---|---|
Type | Description |
Int32 | A hash code for this value. |
Parse(String)
public static BigQueryBigNumeric Parse(string text)
Parses a textual representation as a BigQueryBigNumeric.
Parameter | |
---|---|
Name | Description |
text | String The text to parse. Must not be null. |
Returns | |
---|---|
Type | Description |
BigQueryBigNumeric | The parsed value. |
text
must be a representation of a decimal value which can be represented by BigQueryBigNumeric,
using "." as a decimal place where one is specified, and a leading "-" for negative values. Leading zeroes and insignificant
trailing digits are permitted.
Exceptions | |
---|---|
Type | Description |
FormatException | The value could not be parsed as a BigQueryBigNumeric. |
ToDecimal(LossOfPrecisionHandling)
public decimal ToDecimal(LossOfPrecisionHandling lossOfPrecisionHandling)
Converts this value to BigQueryBigNumeric,
Parameter | |
---|---|
Name | Description |
lossOfPrecisionHandling | LossOfPrecisionHandling How to handle values with signficant digits that would be lost by the conversion. |
Returns | |
---|---|
Type | Description |
Decimal | The converted value. |
This conversion may silently lose precision, depending on lossOfPrecisionHandling
, but
will always throw OverflowException if value is out of the range of Decimal.
Exceptions | |
---|---|
Type | Description |
OverflowException | This value is outside the range of Decimal. |
ToString()
public override string ToString()
Returns a canonical string representation of this value. This always uses "." as a decimal point, and only includes as many decimal places as are required to completely represent the value. If the value is between -1 and 1 exclusive, a "0" character is included before the decimal point.
Returns | |
---|---|
Type | Description |
String | A canonical string representation of this value. |
TryParse(String, out BigQueryBigNumeric)
public static bool TryParse(string text, out BigQueryBigNumeric value)
Attempts to parse a textual representation of a BigQueryBigNumeric value.
Parameters | |
---|---|
Name | Description |
text | String The text to parse. Must not be null. |
value | BigQueryBigNumeric The parsed value, or 0 on failure. |
Returns | |
---|---|
Type | Description |
Boolean |
|
See Parse(String) for format details. This method will return true
if and only if
Parse(String) would return without an exception.
Operators
Addition(BigQueryBigNumeric, BigQueryBigNumeric)
public static BigQueryBigNumeric operator +(BigQueryBigNumeric lhs, BigQueryBigNumeric rhs)
Returns the result of adding two BigQueryBigNumeric values together.
Parameters | |
---|---|
Name | Description |
lhs | BigQueryBigNumeric The first value to add. |
rhs | BigQueryBigNumeric The second value to add. |
Returns | |
---|---|
Type | Description |
BigQueryBigNumeric | The result of adding the two values. |
Equality(BigQueryBigNumeric, BigQueryBigNumeric)
public static bool operator ==(BigQueryBigNumeric lhs, BigQueryBigNumeric rhs)
Compares two values for equality.
Parameters | |
---|---|
Name | Description |
lhs | BigQueryBigNumeric The first value to compare. |
rhs | BigQueryBigNumeric The second value to compare. |
Returns | |
---|---|
Type | Description |
Boolean |
|
Explicit(BigQueryBigNumeric to Decimal)
public static explicit operator decimal (BigQueryBigNumeric value)
Explicit conversion from BigQueryBigNumeric to Decimal.
Parameter | |
---|---|
Name | Description |
value | BigQueryBigNumeric The numeric value to convert. |
Returns | |
---|---|
Type | Description |
Decimal | The result of the conversion. |
This conversion may silently lose precision, but will throw OverflowException if the value is out of range of Decimal. Use ToDecimal(LossOfPrecisionHandling) passing in Throw for the second argument to avoid any information loss.
Implicit(Decimal to BigQueryBigNumeric)
public static implicit operator BigQueryBigNumeric(decimal value)
Explicit conversion from Decimal to BigQueryBigNumeric. This conversion never loses precision.
Parameter | |
---|---|
Name | Description |
value | Decimal The decimal value to convert. |
Returns | |
---|---|
Type | Description |
BigQueryBigNumeric | The result of the conversion. |
Implicit(Int32 to BigQueryBigNumeric)
public static implicit operator BigQueryBigNumeric(int value)
Implicit conversion from Int32 to BigQueryBigNumeric.
Parameter | |
---|---|
Name | Description |
value | Int32 The integer value to convert. |
Returns | |
---|---|
Type | Description |
BigQueryBigNumeric | The result of the conversion. |
This conversion exists to avoid ambiguity between the 64-bit conversions when using an integer literal.
Implicit(Int64 to BigQueryBigNumeric)
public static implicit operator BigQueryBigNumeric(long value)
Implicit conversion from Int64 to BigQueryBigNumeric.
Parameter | |
---|---|
Name | Description |
value | Int64 The integer value to convert. |
Returns | |
---|---|
Type | Description |
BigQueryBigNumeric | The result of the conversion. |
Implicit(UInt64 to BigQueryBigNumeric)
public static implicit operator BigQueryBigNumeric(ulong value)
Implicit conversion from UInt64 to BigQueryBigNumeric.
Parameter | |
---|---|
Name | Description |
value | UInt64 The integer value to convert. |
Returns | |
---|---|
Type | Description |
BigQueryBigNumeric | The result of the conversion. |
Inequality(BigQueryBigNumeric, BigQueryBigNumeric)
public static bool operator !=(BigQueryBigNumeric lhs, BigQueryBigNumeric rhs)
Compares two values for inequality.
Parameters | |
---|---|
Name | Description |
lhs | BigQueryBigNumeric The first value to compare. |
rhs | BigQueryBigNumeric The second value to compare. |
Returns | |
---|---|
Type | Description |
Boolean |
|
Subtraction(BigQueryBigNumeric, BigQueryBigNumeric)
public static BigQueryBigNumeric operator -(BigQueryBigNumeric lhs, BigQueryBigNumeric rhs)
Returns the result of subtracting one BigQueryBigNumeric value from another.
Parameters | |
---|---|
Name | Description |
lhs | BigQueryBigNumeric The value to subtract from. |
rhs | BigQueryBigNumeric The value to subtract. |
Returns | |
---|---|
Type | Description |
BigQueryBigNumeric | The result of subtracting |
UnaryNegation(BigQueryBigNumeric)
public static BigQueryBigNumeric operator -(BigQueryBigNumeric value)
The unary negation operator.
Parameter | |
---|---|
Name | Description |
value | BigQueryBigNumeric The value to negate. |
Returns | |
---|---|
Type | Description |
BigQueryBigNumeric | The negation of |
UnaryPlus(BigQueryBigNumeric)
public static BigQueryBigNumeric operator +(BigQueryBigNumeric value)
The unary plus operator, provided mainly for consistency.
Parameter | |
---|---|
Name | Description |
value | BigQueryBigNumeric The value to return. |
Returns | |
---|---|
Type | Description |
BigQueryBigNumeric | The original value. |
Explicit Interface Implementations
IComparable.CompareTo(Object)
int IComparable.CompareTo(object obj)
Implementation of CompareTo(Object) to compare two BigQueryBigNumeric values.
Parameter | |
---|---|
Name | Description |
obj | Object The object to compare this value with. |
Returns | |
---|---|
Type | Description |
Int32 | The result of comparing this value with |
This uses explicit interface implementation to avoid it being called accidentally. The generic implementation should usually be preferred.
Exceptions | |
---|---|
Type | Description |
ArgumentException |
|