def engineering(value, precision=3, prefix=False, prefixes=SI):
    """ Convert a number to engineering notation. """

    display = decimal.Context(prec=precision)
    value = decimal.Decimal(value).normalize(context=display)
    string = value.to_eng_string()

    if prefix:
        prefixes = {e(exponent): prefix for exponent, prefix in prefixes.items()}
        return replace(string, prefixes)
    else:
        return string
def engineering ( value , precision = 3 , prefix = False , prefixes = SI ) : display = decimal . Context ( prec = precision ) value = decimal . Decimal ( value ) . normalize ( context = display ) string = value . to_eng_string ( ) if prefix : prefixes = { e ( exponent ) : prefix for exponent , prefix in prefixes . items ( ) } return replace ( string , prefixes ) else : return string
Convert a number to engineering notation.