IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.
|
Represents a real number. More...
Public Member Functions | |
Scalar (Scalar v) | |
Scalar (double v) | |
void | Copy (Scalar s) |
Copies a scalar to the current scalar. | |
void | Copy (double d) |
Copies double to the current scalar. | |
int | Compare (Scalar a, Scalar b) |
override bool | Equals (object obj) |
Indicates whether obj is equal to this instance. | |
bool | Equals (Scalar a) |
Indicates whether a is equal to this instance. | |
override int | GetHashCode () |
Gets the hashcode of this Scalar . | |
int | CompareTo (Scalar other) |
Compare this Scalar with another Scalar. | |
override string | ToString () |
Returns standard string representation of a scalar, with decimal point and e for exponent, no 1000 separators, number of digits according to type accuracy. | |
string | ToString (string format, IFormatProvider formatProvider) |
Returns a string representation of a scalar in the specified way. | |
int | read (string str) |
Reads in the value from a string, starting at the beginning and skipping any leading spaces. Returns the position of the first character after the read scalar (or -1 if reading failed) and outputs the read scalar. | |
int | Read (string str, int startpos) |
Reads in the value from a string, starting at a specified position and skipping any leading spaces. Returns the position of the first character after the read scalar (or -1 if reading failed) and outputs the read scalar. | |
int | Read (string str, int startpos, bool skipspaces) |
Reads in the value from a string, starting at a specified position. Returns the position of the first character after the read scalar (or -1 if reading failed) and outputs the read scalar. | |
void | Copy (string str) |
Parses a scalar from a string and sets the value to the parsed scalar. Leading and trailing spaces are ignored, but other characters are not. FormatException is thrown if the string does not represent a scalar. | |
bool | TryCopy (string str) |
Parses a scalar from a string and sets the value to the parsed scalar. Leading and trailing spaces are ignored, but other characters are not. false is returned if parsing was not successful, but no exception is thrown in this case. | |
Static Public Member Functions | |
static void | Copy (Scalar a, ref Scalar res) |
Copies a scalar to another (existing) scalar in place. | |
static void | Copy (double a, ref Scalar res) |
Copies a number to an (existing) scalar in place. | |
static Scalar | NaN () |
Creates a scalar that is not a number. | |
static Scalar | PositiveInfinity () |
Creates a scalar that represents positive infinity. | |
static Scalar | NegativeInfinity () |
Creates a scalar that represents negative infinity. | |
static Scalar | MinValue () |
Creates a scalar that contains minimal representable value. | |
static Scalar | MaxValue () |
Creates a scalar that contains maximal representable value. | |
static Scalar | Epsilon () |
Creates a scalar that contains the smallest positive value greater than 0. | |
static Scalar | operator+ (Scalar s) |
static Scalar | operator- (Scalar s) |
static Scalar | operator+ (Scalar a, Scalar b) |
static Scalar | operator- (Scalar a, Scalar b) |
static Scalar | operator* (Scalar a, Scalar b) |
static Scalar | operator/ (Scalar a, Scalar b) |
static bool | operator== (Scalar a, Scalar b) |
static bool | operator!= (Scalar a, Scalar b) |
static bool | operator< (Scalar a, Scalar b) |
static bool | operator> (Scalar a, Scalar b) |
static bool | operator<= (Scalar a, Scalar b) |
static bool | operator>= (Scalar a, Scalar b) |
static implicit | operator double (Scalar a) |
Implicit conversion from Scalar to double. | |
static implicit | operator Scalar (double a) |
Implicit conversion from double to Scalar. | |
static int | Read (ref Scalar result, string str) |
Reads a scalar from a string, starting at the beginning and skipping any leading spaces. Returns the position of the first character after the read scalar (or -1 if reading failed) and outputs the read scalar. | |
static int | Read (ref Scalar result, string str, int startpos) |
Reads a scalar from a string, starting at a specified position and skipping any leading spaces. Returns the position of the first character after the read scalar (or -1 if reading failed) and outputs the read scalar. | |
static int | Read (ref Scalar result, string str, int startpos, bool skipspaces) |
Reads a scalar from a string, starting at a specified position. Returns the position of the first character after the read scalar (or -1 if reading failed) and outputs the read scalar. | |
static Scalar | Parse (string str) |
Parses a scalar from a string and returns it. Leading and trailing spaces are ignored, but other characters are not. FormatException is thrown if the string does not represent a scalar. | |
static bool | TryParse (string str, ref Scalar result) |
Parses a scalar from a string and returns it. Leading and trailing spaces are ignored, but other characters are not. false is returned if parsing was not successful, but no exception is thrown in this case. | |
static void | Examples () |
Examples of using the Scalar class. | |
Public Attributes | |
double | Value |
Value of the scalar. | |
Properties | |
static Scalar | One [get] |
Returns a scalar with value 1. | |
static Scalar | Zero [get] |
Returns a scalar with value 0. | |
bool | IsNaN [get] |
Indicates whether the current Scalar is not a number. | |
bool | IsPositiveInfinity [get] |
Indicates whether the current Scalar represents positive infinity. | |
bool | IsNegativeInfinity [get] |
Indicates whether the current Scalar represents negative infinity. | |
bool | IsInfinity [get] |
Indicates whether the current Scalar represents infinity. |
Represents a real number.
IG::Num::Scalar::Scalar | ( | Scalar | v | ) | [inline] |
IG::Num::Scalar::Scalar | ( | double | v | ) | [inline] |
void IG::Num::Scalar::Copy | ( | Scalar | s | ) | [inline] |
Copies a scalar to the current scalar.
void IG::Num::Scalar::Copy | ( | double | d | ) | [inline] |
Copies double to the current scalar.
static void IG::Num::Scalar::Copy | ( | double | a, |
ref Scalar | res | ||
) | [inline, static] |
Copies a number to an (existing) scalar in place.
a | Number that is copied. |
res | Scalar where result is stored. |
static Scalar IG::Num::Scalar::NaN | ( | ) | [inline, static] |
Creates a scalar that is not a number.
static Scalar IG::Num::Scalar::PositiveInfinity | ( | ) | [inline, static] |
Creates a scalar that represents positive infinity.
static Scalar IG::Num::Scalar::NegativeInfinity | ( | ) | [inline, static] |
Creates a scalar that represents negative infinity.
static Scalar IG::Num::Scalar::MinValue | ( | ) | [inline, static] |
Creates a scalar that contains minimal representable value.
static Scalar IG::Num::Scalar::MaxValue | ( | ) | [inline, static] |
Creates a scalar that contains maximal representable value.
static Scalar IG::Num::Scalar::Epsilon | ( | ) | [inline, static] |
Creates a scalar that contains the smallest positive value greater than 0.
override bool IG::Num::Scalar::Equals | ( | object | obj | ) | [inline] |
Indicates whether obj
is equal to this instance.
bool IG::Num::Scalar::Equals | ( | Scalar | a | ) | [inline] |
Indicates whether a
is equal to this instance.
override int IG::Num::Scalar::GetHashCode | ( | ) | [inline] |
Gets the hashcode of this Scalar
.
int IG::Num::Scalar::CompareTo | ( | Scalar | other | ) | [inline] |
static implicit IG::Num::Scalar::operator double | ( | Scalar | a | ) | [inline, static] |
Implicit conversion from Scalar to double.
static implicit IG::Num::Scalar::operator Scalar | ( | double | a | ) | [inline, static] |
Implicit conversion from double to Scalar.
override string IG::Num::Scalar::ToString | ( | ) | [inline] |
Returns standard string representation of a scalar, with decimal point and e for exponent, no 1000 separators, number of digits according to type accuracy.
string IG::Num::Scalar::ToString | ( | string | format, |
IFormatProvider | formatProvider | ||
) | [inline] |
Returns a string representation of a scalar in the specified way.
format | the format string. |
formatProvider | The bormat provider used. |
static int IG::Num::Scalar::Read | ( | ref Scalar | result, |
string | str | ||
) | [inline, static] |
Reads a scalar from a string, starting at the beginning and skipping any leading spaces. Returns the position of the first character after the read scalar (or -1 if reading failed) and outputs the read scalar.
result | Output parameter returning the scalar that was read. |
str | String from which the scalar is read. |
static int IG::Num::Scalar::Read | ( | ref Scalar | result, |
string | str, | ||
int | startpos | ||
) | [inline, static] |
Reads a scalar from a string, starting at a specified position and skipping any leading spaces. Returns the position of the first character after the read scalar (or -1 if reading failed) and outputs the read scalar.
result | Output parameter returning the scalar that was read. |
str | String from which the scalar is read. |
startpos | Starting position from which scalar is searched for. |
at the starting position.
static int IG::Num::Scalar::Read | ( | ref Scalar | result, |
string | str, | ||
int | startpos, | ||
bool | skipspaces | ||
) | [inline, static] |
Reads a scalar from a string, starting at a specified position. Returns the position of the first character after the read scalar (or -1 if reading failed) and outputs the read scalar.
result | Output parameter returning the scalar that was read. |
str | String from which the scalar is read. |
startpos | Starting position from which scalar is searched for. |
skipspaces | If true then leading spaces are ignored, otherwise operation fails if there is a whitespace at the starting position. |
static Scalar IG::Num::Scalar::Parse | ( | string | str | ) | [inline, static] |
Parses a scalar from a string and returns it. Leading and trailing spaces are ignored, but other characters are not. FormatException is thrown if the string does not represent a scalar.
str | String that is parsed. |
static bool IG::Num::Scalar::TryParse | ( | string | str, |
ref Scalar | result | ||
) | [inline, static] |
Parses a scalar from a string and returns it. Leading and trailing spaces are ignored, but other characters are not. false is returned if parsing was not successful, but no exception is thrown in this case.
str | String that is parsed. |
int IG::Num::Scalar::read | ( | string | str | ) | [inline] |
Reads in the value from a string, starting at the beginning and skipping any leading spaces. Returns the position of the first character after the read scalar (or -1 if reading failed) and outputs the read scalar.
str | String from which the scalar is read. |
int IG::Num::Scalar::Read | ( | string | str, |
int | startpos | ||
) | [inline] |
Reads in the value from a string, starting at a specified position and skipping any leading spaces. Returns the position of the first character after the read scalar (or -1 if reading failed) and outputs the read scalar.
result | Output parameter returning the scalar that was read. |
str | String from which the scalar is read. |
startpos | Starting position from which scalar is searched for. |
at the starting position.
int IG::Num::Scalar::Read | ( | string | str, |
int | startpos, | ||
bool | skipspaces | ||
) | [inline] |
Reads in the value from a string, starting at a specified position. Returns the position of the first character after the read scalar (or -1 if reading failed) and outputs the read scalar.
str | String from which the scalar is read. |
startpos | Starting position from which scalar is searched for. |
skipspaces | If true then leading spaces are ignored, otherwise operation fails if there is a whitespace at the starting position. |
void IG::Num::Scalar::Copy | ( | string | str | ) | [inline] |
Parses a scalar from a string and sets the value to the parsed scalar. Leading and trailing spaces are ignored, but other characters are not. FormatException is thrown if the string does not represent a scalar.
str | String that is parsed. |
bool IG::Num::Scalar::TryCopy | ( | string | str | ) | [inline] |
Parses a scalar from a string and sets the value to the parsed scalar. Leading and trailing spaces are ignored, but other characters are not. false is returned if parsing was not successful, but no exception is thrown in this case.
str | String that is parsed. |
static void IG::Num::Scalar::Examples | ( | ) | [inline, static] |
Examples of using the Scalar class.
double IG::Num::Scalar::Value |
Value of the scalar.
Scalar IG::Num::Scalar::One [static, get] |
Returns a scalar with value 1.
Scalar IG::Num::Scalar::Zero [static, get] |
Returns a scalar with value 0.
bool IG::Num::Scalar::IsNaN [get] |
Indicates whether the current Scalar
is not a number.
bool IG::Num::Scalar::IsPositiveInfinity [get] |
Indicates whether the current Scalar
represents positive infinity.
bool IG::Num::Scalar::IsNegativeInfinity [get] |
Indicates whether the current Scalar
represents negative infinity.
bool IG::Num::Scalar::IsInfinity [get] |
Indicates whether the current Scalar
represents infinity.