Struct TemperatureValue
- Namespace
- xFunc.Maths.Expressions.Units.TemperatureUnits
- Assembly
- xFunc.Maths.dll
Represents a number with temperature unit.
public readonly struct TemperatureValue : IEquatable<TemperatureValue>, IComparable<TemperatureValue>, IComparable
- Implements
- Inherited Members
Constructors
TemperatureValue(NumberValue, TemperatureUnit)
Initializes a new instance of the TemperatureValue struct.
public TemperatureValue(NumberValue value, TemperatureUnit unit)
Parameters
value
NumberValueThe value.
unit
TemperatureUnitThe unit of number.
Properties
Sign
Gets an integer that indicates the sign of a double-precision floating-point number.
public double Sign { get; }
Property Value
Unit
Gets a unit.
public TemperatureUnit Unit { get; }
Property Value
Value
Gets a value.
public NumberValue Value { get; }
Property Value
Methods
Abs(TemperatureValue)
Returns the absolute value of a specified temperature value.
public static TemperatureValue Abs(TemperatureValue value)
Parameters
value
TemperatureValueThe temperature value.
Returns
- TemperatureValue
The temperature value,
x
, that such that 0 ≤x
≤MaxValue
.
AsExpression()
Converts TemperatureValue to Temperature.
public Temperature AsExpression()
Returns
- Temperature
The temperature number.
Ceiling(TemperatureValue)
Returns the smallest integral value that is greater than or equal to the specified temperature value.
public static TemperatureValue Ceiling(TemperatureValue value)
Parameters
value
TemperatureValueThe temperature value.
Returns
- TemperatureValue
The smallest integral value.
Celsius(double)
Creates the TemperatureValue struct with Celsius
unit.
public static TemperatureValue Celsius(double value)
Parameters
value
doubleThe value.
Returns
- TemperatureValue
The temperature value.
Celsius(NumberValue)
Creates the TemperatureValue struct with Celsius
unit.
public static TemperatureValue Celsius(NumberValue numberValue)
Parameters
numberValue
NumberValueThe value.
Returns
- TemperatureValue
The temperature value.
CompareTo(object?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object? obj)
Parameters
obj
objectAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes obj
in the sort order.Zero This instance occurs in the same position in the sort order as obj
.Greater than zero This instance follows obj
in the sort order.
Exceptions
- ArgumentException
obj
is not the same type as this instance.
CompareTo(TemperatureValue)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(TemperatureValue other)
Parameters
other
TemperatureValueAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes other
in the sort order.Zero This instance occurs in the same position in the sort order as other
.Greater than zero This instance follows other
in the sort order.
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
Equals(TemperatureValue)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(TemperatureValue other)
Parameters
other
TemperatureValueAn object to compare with this object.
Returns
Fahrenheit(double)
Creates the TemperatureValue struct with Fahrenheit
unit.
public static TemperatureValue Fahrenheit(double value)
Parameters
value
doubleThe value.
Returns
- TemperatureValue
The temperature value.
Fahrenheit(NumberValue)
Creates the TemperatureValue struct with Fahrenheit
unit.
public static TemperatureValue Fahrenheit(NumberValue numberValue)
Parameters
numberValue
NumberValueThe value.
Returns
- TemperatureValue
The temperature value.
Floor(TemperatureValue)
Returns the largest integral value less than or equal to the specified temperature value number.
public static TemperatureValue Floor(TemperatureValue value)
Parameters
value
TemperatureValueThe temperature value.
Returns
- TemperatureValue
The largest integral value.
Frac(TemperatureValue)
Returns the fractional part of the temperature value number.
public static TemperatureValue Frac(TemperatureValue value)
Parameters
value
TemperatureValueThe temperature value number.
Returns
- TemperatureValue
The fractional part.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Kelvin(double)
Creates the TemperatureValue struct with Kelvin
unit.
public static TemperatureValue Kelvin(double value)
Parameters
value
doubleThe value.
Returns
- TemperatureValue
The temperature value.
Kelvin(NumberValue)
Creates the TemperatureValue struct with Kelvin
unit.
public static TemperatureValue Kelvin(NumberValue numberValue)
Parameters
numberValue
NumberValueThe value.
Returns
- TemperatureValue
The temperature value.
Round(TemperatureValue, NumberValue)
Rounds a double-precision floating-point value to a specified number of fractional digits, and uses the specified rounding convention for midpoint values.
public static TemperatureValue Round(TemperatureValue temperatureValue, NumberValue digits)
Parameters
temperatureValue
TemperatureValueThe temperature number.
digits
NumberValueThe number of fractional digits in the return value.
Returns
- TemperatureValue
The number nearest to
temperatureValue
that has a number of fractional digits equal todigits
. If value has fewer fractional digits thandigits
,temperatureValue
is returned unchanged.
To(TemperatureUnit)
Convert to the newUnit
unit.
public TemperatureValue To(TemperatureUnit newUnit)
Parameters
newUnit
TemperatureUnitThe new unit.
Returns
- TemperatureValue
The value in the new unit.
ToCelsius()
Converts the current object to celsius.
public TemperatureValue ToCelsius()
Returns
- TemperatureValue
The power value which is converted to celsius.
ToFahrenheit()
Converts the current object to fahrenheit.
public TemperatureValue ToFahrenheit()
Returns
- TemperatureValue
The power value which is converted to fahrenheit.
ToKelvin()
Converts the current object to kelvin.
public TemperatureValue ToKelvin()
Returns
- TemperatureValue
The power value which is converted to kelvin.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Truncate(TemperatureValue)
Calculates the integral part of a specified temperature value number.
public static TemperatureValue Truncate(TemperatureValue value)
Parameters
value
TemperatureValueAn temperature value to truncate.
Returns
- TemperatureValue
The integral part of temperature value number.
Operators
operator +(TemperatureValue, TemperatureValue)
Adds two objects of TemperatureValue.
public static TemperatureValue operator +(TemperatureValue left, TemperatureValue right)
Parameters
left
TemperatureValueThe first object to add.
right
TemperatureValueThe second object to add.
Returns
- TemperatureValue
An object that is the sum of
left
andright
.
operator ==(TemperatureValue, TemperatureValue)
Determines whether two specified instances of TemperatureValue are equal.
public static bool operator ==(TemperatureValue left, TemperatureValue right)
Parameters
left
TemperatureValueThe first object to compare.
right
TemperatureValueThe second object to compare.
Returns
- bool
true
ifleft
is equal toright
; otherwise,false
.
operator >(TemperatureValue, TemperatureValue)
Indicates whether left
parameter is greater than the right
parameter.
public static bool operator >(TemperatureValue left, TemperatureValue right)
Parameters
left
TemperatureValueThe left power value.
right
TemperatureValueThe right power value.
Returns
- bool
true
if theleft
parameter is greater than theright
parameter; otherwise,false
.
operator >=(TemperatureValue, TemperatureValue)
Indicates whether left
parameter is greater than or equal to the right
parameter.
public static bool operator >=(TemperatureValue left, TemperatureValue right)
Parameters
left
TemperatureValueThe left power value.
right
TemperatureValueThe right power value.
Returns
- bool
true
if theleft
parameter is greater than or equal to theright
parameter; otherwise,false
.
operator !=(TemperatureValue, TemperatureValue)
Determines whether two specified instances of TemperatureValue are not equal.
public static bool operator !=(TemperatureValue left, TemperatureValue right)
Parameters
left
TemperatureValueThe first object to compare.
right
TemperatureValueThe second object to compare.
Returns
- bool
true
ifleft
is not equal toright
; otherwise,false
.
operator <(TemperatureValue, TemperatureValue)
Indicates whether left
parameter is less than the right
parameter.
public static bool operator <(TemperatureValue left, TemperatureValue right)
Parameters
left
TemperatureValueThe left power value.
right
TemperatureValueThe right power value.
Returns
- bool
true
if theleft
parameter is less than theright
parameter; otherwise,false
.
operator <=(TemperatureValue, TemperatureValue)
Indicates whether left
parameter is less than or equal to the right
parameter.
public static bool operator <=(TemperatureValue left, TemperatureValue right)
Parameters
left
TemperatureValueThe left power value.
right
TemperatureValueThe right power value.
Returns
- bool
true
if theleft
parameter is less than or equal to theright
parameter; otherwise,false
.
operator -(TemperatureValue, TemperatureValue)
Subtracts two objects of TemperatureValue.
public static TemperatureValue operator -(TemperatureValue left, TemperatureValue right)
Parameters
left
TemperatureValueThe first object to sub.
right
TemperatureValueThe second object to sub.
Returns
- TemperatureValue
An object that is the difference of
left
andright
.
operator -(TemperatureValue)
Produces the negative of TemperatureValue.
public static TemperatureValue operator -(TemperatureValue value)
Parameters
value
TemperatureValueThe power value.
Returns
- TemperatureValue
The negative of
value
.