23 #ifndef MASS_H_62063E22_421F_4578_BAD8_46AF5C66C4CF
24 #define MASS_H_62063E22_421F_4578_BAD8_46AF5C66C4CF
107 const double*
const fromAmount,
108 double*
const toAmount,
static const double MASS_RATIOS[]
const double *const mass_unit_to_ratio(const mass_unit_t u)
Returns a pointer to a double with the number of micrograms per unit.
bool mass_diveq(mass_t *const self, const mass_t *const rhs)
Divide self by rhs, returns false if rhs is 0.
int mass_to_string(const mass_t *const m, char *const buff)
Fills buff with the string representation of the mass_t. eg. "32.4762 mg".
bool mass_lteq(const mass_t *const lhs, const mass_t *const rhs)
Returns true if lhs is less than or equal to rhs.
const char *const mass_unit_to_string(const mass_unit_t u)
Returns a pointer to char with the textual representation of the unit.
void mass_add(const mass_t *const lhs, const mass_t *const rhs, mass_t *const res)
Add lhs to rhs and store result in res.
bool mass_gteq(const mass_t *const lhs, const mass_t *const rhs)
Returns true if lhs is greater than or equal to rhs.
void mass_subeq(mass_t *const self, const mass_t *const rhs)
Subtract rhs from self.
void mass_mul(const mass_t *const lhs, const mass_t *const rhs, mass_t *const res)
Multiply lhs by rhs and store result in res.
void mass_convert(const double *const fromAmount, double *const toAmount, const mass_unit_t fromUnit, const mass_unit_t toUnit)
Converts a floating point value from one unit to another.
bool mass_gt(const mass_t *const lhs, const mass_t *const rhs)
Returns true if lhs is greater than rhs.
void mass_init(mass_t *const m, const mass_unit_t unit, const double val)
Initialises a mass_t with the given unit and value.
static const char *const MASS_NAMES[]
bool mass_neq(const mass_t *const lhs, const mass_t *const rhs)
Returns true if lhs does not equal rhs.
void mass_muleq(mass_t *const self, const mass_t *const rhs)
Multiply self by rhs.
void mass_addeq(mass_t *const self, const mass_t *const rhs)
Add rhs to self.
void mass_sub(const mass_t *const lhs, const mass_t *const rhs, mass_t *const res)
Substract rhs from lhs and store result in res.
bool mass_eq(const mass_t *const lhs, const mass_t *const rhs)
Returns true if lhs equals rhs.
bool mass_div(const mass_t *const lhs, const mass_t *const rhs, mass_t *const res)
Divide lhs by rhs and store result in res, returns false if rhs is 0.
bool mass_lt(const mass_t *const lhs, const mass_t *const rhs)
Returns true if lhs is less than rhs.
static const size_t MASS_TO_STRING_BUFF_SIZE
void mass_get_value(const mass_t *const m, double *const val)
Sets val to the value representing the mass_t according to its unt.