scifir-units 2.0.0
scifir-units is a library of units of measurement, angles, coordinates, fields, and related data, all lightweight, that help in the development of scientific software and scientific machines
|
#include "../util/is_number.hpp"
#include "../units/scalar_unit.hpp"
#include "boost/math/constants/constants.hpp"
#include <cmath>
#include <string>
Go to the source code of this file.
Classes | |
class | scifir::percentage |
Class that allows to handle percentages and do calculations with it easy. It supports normal percentages (with %), ppm, ppb, ppt and ppq. The types ppb, ppt and ppq are currently not supported because the float type in percentage class can't store so lower values. More... | |
Namespaces | |
namespace | scifir |
The namespace scifir contains all scifir-units, excepting the string literals, which are outside. | |
Functions | |
string | scifir::to_string (const percentage &x) |
Returns a string representation of percentage x. | |
bool | scifir::is_percentage (const string &init_percentage) |
Checks if a string is an initialization string of percentage. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
scifir::percentage | operator+ (T x, const scifir::percentage &y) |
Creates a new percentage as the addition of the percentage with the numeric type x. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
scifir::percentage | operator- (T x, const scifir::percentage &y) |
Creates a new percentage as the difference of the percentage with the numeric type x. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
float | operator* (T x, const scifir::percentage &y) |
Creates a new percentage as the multiplication of the percentage with the numeric type x. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
float | operator/ (T x, const scifir::percentage &y) |
Creates a new percentage as the division of the percentage with the numeric type x. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
bool | operator== (T x, const scifir::percentage &y) |
Returns true if the value of percentage is equal to the numeric type x. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
bool | operator!= (T x, const scifir::percentage &y) |
Returns true if the value of percentage is not equal to the numeric type x. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
bool | operator< (T x, const scifir::percentage &y) |
Returns true if the numeric type x is lower than the value of percentage y. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
bool | operator> (T x, const scifir::percentage &y) |
Returns true if the numeric type x is greather than the value of percentage y. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
bool | operator<= (T x, const scifir::percentage &y) |
Returns true if the numeric type x is lower or equal than the value of percentage y. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
bool | operator>= (T x, const scifir::percentage &y) |
Returns true if the numeric type x is equal or greather than the value of percentage y. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
bool | operator== (const scifir::percentage &y, T x) |
Returns true if the value of percentage is equal to the numeric type x. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
bool | operator!= (const scifir::percentage &y, T x) |
Returns true if the value of percentage is not equal to the numeric type x. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
bool | operator< (const scifir::percentage &y, T x) |
Returns true if the value of percentage y is lower than the numeric type x. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
bool | operator> (const scifir::percentage &y, T x) |
Returns true if the value of percentage y is greather than the numeric type x. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
bool | operator<= (const scifir::percentage &y, T x) |
Returns true if the value of percentage y is lower or equal than the numeric type x. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
bool | operator>= (const scifir::percentage &y, T x) |
Returns true if the value of percentage y is equal or greather than the numeric type x. | |
scifir::scalar_unit | operator* (const scifir::scalar_unit &x, const scifir::percentage &y) |
Multiplies the percentage with the scalar_unit x to create a percentage of that scalar_unit. | |
scifir::scalar_unit | operator/ (const scifir::scalar_unit &x, const scifir::percentage &y) |
Multiplies the scalar_unit x by the percentage equal to the inverse of percentage y. | |
bool | operator== (const scifir::percentage &x, const scifir::percentage &y) |
Returns true if the value of percentage x is equal to the value of percentage y. | |
bool | operator!= (const scifir::percentage &x, const scifir::percentage &y) |
Returns true if the value of percentage x is not equal to the value of percentage y. | |
bool | operator< (const scifir::percentage &x, const scifir::percentage &y) |
Returns true if the value of percentage x is lower than the value of percentage y. | |
bool | operator> (const scifir::percentage &x, const scifir::percentage &y) |
Returns true if the value of percentage x is greather than the value of percentage y. | |
bool | operator<= (const scifir::percentage &x, const scifir::percentage &y) |
Returns true if the value of percentage x is lower or equal than the value of percentage y. | |
bool | operator>= (const scifir::percentage &x, const scifir::percentage &y) |
Returns true if the value of percentage x is equal or greather than the value of percentage y. | |
bool | operator== (const scifir::percentage &x, const string &init_percentage) |
Returns true if x and the percentage constructed with init_percentage are equal. | |
bool | operator!= (const scifir::percentage &x, const string &init_percentage) |
Returns true if x and the percentage constructed with init_percentage are different. | |
bool | operator== (const string &init_percentage, const scifir::percentage &x) |
Returns true if x and the percentage constructed with init_percentage are equal. | |
bool | operator!= (const string &init_percentage, const scifir::percentage &x) |
Returns true if x and the percentage constructed with init_percentage are different. | |
void | operator+= (string &x, const scifir::percentage &y) |
Concatenates the string representation of percentage y to the string x. | |
string | operator+ (const string &x, const scifir::percentage &y) |
Concatenates x with the string representation of percentage y. | |
string | operator+ (const scifir::percentage &y, const string &x) |
Concatenates x with the string representation of percentage y. | |
ostream & | operator<< (ostream &os, const scifir::percentage &x) |
Adds the string representation of the percentage x to an output stream os. | |
istream & | operator>> (istream &is, scifir::percentage &x) |
Allows that an istream initializes by string a percentage x. | |
bool operator!= | ( | const scifir::percentage & | x, |
const scifir::percentage & | y | ||
) |
Returns true if the value of percentage x is not equal to the value of percentage y.
Definition at line 560 of file percentage.cpp.
bool operator!= | ( | const scifir::percentage & | x, |
const string & | init_percentage | ||
) |
Returns true if x and the percentage constructed with init_percentage are different.
Definition at line 605 of file percentage.cpp.
bool operator!= | ( | const scifir::percentage & | y, |
T | x | ||
) |
Returns true if the value of percentage is not equal to the numeric type x.
Definition at line 216 of file percentage.hpp.
bool operator!= | ( | const string & | init_percentage, |
const scifir::percentage & | x | ||
) |
Returns true if x and the percentage constructed with init_percentage are different.
Definition at line 616 of file percentage.cpp.
bool operator!= | ( | T | x, |
const scifir::percentage & | y | ||
) |
Returns true if the value of percentage is not equal to the numeric type x.
Definition at line 180 of file percentage.hpp.
scifir::scalar_unit operator* | ( | const scifir::scalar_unit & | x, |
const scifir::percentage & | y | ||
) |
Multiplies the percentage with the scalar_unit x to create a percentage of that scalar_unit.
Definition at line 538 of file percentage.cpp.
float operator* | ( | T | x, |
const scifir::percentage & | y | ||
) |
Creates a new percentage as the multiplication of the percentage with the numeric type x.
Definition at line 162 of file percentage.hpp.
string operator+ | ( | const scifir::percentage & | y, |
const string & | x | ||
) |
Concatenates x with the string representation of percentage y.
Definition at line 636 of file percentage.cpp.
string operator+ | ( | const string & | x, |
const scifir::percentage & | y | ||
) |
Concatenates x with the string representation of percentage y.
Definition at line 628 of file percentage.cpp.
scifir::percentage operator+ | ( | T | x, |
const scifir::percentage & | y | ||
) |
Creates a new percentage as the addition of the percentage with the numeric type x.
Definition at line 150 of file percentage.hpp.
void operator+= | ( | string & | x, |
const scifir::percentage & | y | ||
) |
Concatenates the string representation of percentage y to the string x.
Definition at line 621 of file percentage.cpp.
scifir::percentage operator- | ( | T | x, |
const scifir::percentage & | y | ||
) |
Creates a new percentage as the difference of the percentage with the numeric type x.
Definition at line 156 of file percentage.hpp.
scifir::scalar_unit operator/ | ( | const scifir::scalar_unit & | x, |
const scifir::percentage & | y | ||
) |
Multiplies the scalar_unit x by the percentage equal to the inverse of percentage y.
Definition at line 543 of file percentage.cpp.
float operator/ | ( | T | x, |
const scifir::percentage & | y | ||
) |
Creates a new percentage as the division of the percentage with the numeric type x.
Definition at line 168 of file percentage.hpp.
bool operator< | ( | const scifir::percentage & | x, |
const scifir::percentage & | y | ||
) |
Returns true if the value of percentage x is lower than the value of percentage y.
Definition at line 565 of file percentage.cpp.
bool operator< | ( | const scifir::percentage & | y, |
T | x | ||
) |
Returns true if the value of percentage y is lower than the numeric type x.
Definition at line 222 of file percentage.hpp.
bool operator< | ( | T | x, |
const scifir::percentage & | y | ||
) |
Returns true if the numeric type x is lower than the value of percentage y.
Definition at line 186 of file percentage.hpp.
ostream & operator<< | ( | ostream & | os, |
const scifir::percentage & | x | ||
) |
Adds the string representation of the percentage x to an output stream os.
Definition at line 644 of file percentage.cpp.
bool operator<= | ( | const scifir::percentage & | x, |
const scifir::percentage & | y | ||
) |
Returns true if the value of percentage x is lower or equal than the value of percentage y.
Definition at line 589 of file percentage.cpp.
bool operator<= | ( | const scifir::percentage & | y, |
T | x | ||
) |
Returns true if the value of percentage y is lower or equal than the numeric type x.
Definition at line 234 of file percentage.hpp.
bool operator<= | ( | T | x, |
const scifir::percentage & | y | ||
) |
Returns true if the numeric type x is lower or equal than the value of percentage y.
Definition at line 198 of file percentage.hpp.
bool operator== | ( | const scifir::percentage & | x, |
const scifir::percentage & | y | ||
) |
Returns true if the value of percentage x is equal to the value of percentage y.
Definition at line 548 of file percentage.cpp.
bool operator== | ( | const scifir::percentage & | x, |
const string & | init_percentage | ||
) |
Returns true if x and the percentage constructed with init_percentage are equal.
Definition at line 599 of file percentage.cpp.
bool operator== | ( | const scifir::percentage & | y, |
T | x | ||
) |
Returns true if the value of percentage is equal to the numeric type x.
Definition at line 210 of file percentage.hpp.
bool operator== | ( | const string & | init_percentage, |
const scifir::percentage & | x | ||
) |
Returns true if x and the percentage constructed with init_percentage are equal.
Definition at line 610 of file percentage.cpp.
bool operator== | ( | T | x, |
const scifir::percentage & | y | ||
) |
Returns true if the value of percentage is equal to the numeric type x.
Definition at line 174 of file percentage.hpp.
bool operator> | ( | const scifir::percentage & | x, |
const scifir::percentage & | y | ||
) |
Returns true if the value of percentage x is greather than the value of percentage y.
Definition at line 577 of file percentage.cpp.
bool operator> | ( | const scifir::percentage & | y, |
T | x | ||
) |
Returns true if the value of percentage y is greather than the numeric type x.
Definition at line 228 of file percentage.hpp.
bool operator> | ( | T | x, |
const scifir::percentage & | y | ||
) |
Returns true if the numeric type x is greather than the value of percentage y.
Definition at line 192 of file percentage.hpp.
bool operator>= | ( | const scifir::percentage & | x, |
const scifir::percentage & | y | ||
) |
Returns true if the value of percentage x is equal or greather than the value of percentage y.
Definition at line 594 of file percentage.cpp.
bool operator>= | ( | const scifir::percentage & | y, |
T | x | ||
) |
Returns true if the value of percentage y is equal or greather than the numeric type x.
Definition at line 240 of file percentage.hpp.
bool operator>= | ( | T | x, |
const scifir::percentage & | y | ||
) |
Returns true if the numeric type x is equal or greather than the value of percentage y.
Definition at line 204 of file percentage.hpp.
istream & operator>> | ( | istream & | is, |
scifir::percentage & | x | ||
) |
Allows that an istream initializes by string a percentage x.
Definition at line 649 of file percentage.cpp.