Brings an LALUnit
structure into standard form by reducing all of the rational exponents into LCD form.
Since the LALUnit
structure stores the rational powers of the fundamental units as numerator and denominator, it is possible to represent the same units in different ways, e.g., \(\mathrm{m}^2\) versus \(\mathrm{m}^{4/2}\). This function reduces all of those fractions to convert the structure to its simplest form.
The rational powers are reduced using Euclid's algorithm [12] .
Note that the functions XLALUnitRaiseRAT4()
, XLALUnitMultiply()
, and XLALUnitCompare()
all call XLALUnitNormalize()
themselves, so there is usually no need to call it explicitly.
Prototypes | |
static UINT2 | gcd (INT2 numer, UINT2 denom) |
int | XLALUnitNormalize (LALUnit *unit) |
Returns 0 upon success or XLAL_FAILURE if the input pointer is NULL , in which case xlalErrno is set to XLAL_EFAULT. More... | |
Definition at line 54 of file UnitNormalize.c.
int XLALUnitNormalize | ( | LALUnit * | unit | ) |
Returns 0 upon success or XLAL_FAILURE if the input pointer is NULL
, in which case xlalErrno is set to XLAL_EFAULT.
Definition at line 72 of file UnitNormalize.c.