Previous: units_parse, Up: Units


10.3 units_cvt

get the conversion factor from one unit to another

Synopsis

     #include <suplib/units.h>
     
     
     
double units_cvt( const UnitsList *list, int from, int to );

Parameters

const UnitsList *list
the Units list
int from
the unit id of the source unit
int to
the unit id of the destination unit

Description

units_cvt returns a conversion factor from one unit to another. Both units must be in the passed UnitConvertList.

Returns

Upon success (i.e., the units are in the UnitConvertList), it returns the conversion factor. Upon error, it returns ‘0.0’.

Author

Diab Jerius