get_mantissa

Contents

get_mantissa#

class brainunit.math.get_mantissa(obj)#

Return the mantissa of a Quantity or a number.

For a Quantity the numeric value (mantissa) is returned, stripping the unit. For plain numbers or arrays the input is returned unchanged.

Parameters:

obj (object) – The object to check. Can be a Quantity or any numeric type.

Returns:

mantissa – The mantissa of obj.

Return type:

float or array_like

See also

get_dim

Return the dimension of an object.

get_unit

Return the unit of an object.

Examples

>>> import saiunit as u
>>> u.get_mantissa(3.0 * u.mV)
3.0
>>> u.get_mantissa(5.0)
5.0