Пример #1
0
def oct(x):
    if isinstance(x, int):
        return _oct(x)
    else:
        if _is_pointZero(x):
            return _oct(int(x))
        else:
            return x
Пример #2
0
def hex(x):
    if isinstance(x, int):
        return _hex(x)
    else:
        if _is_pointZero(x):
            return _hex(int(x))
        else:
            raise x
Пример #3
0
def hex(x):
    if isinstance(x, int):
        return _hex(x)
    else:
        if _is_pointZero(x):
            return _hex(int(x))
        else:
            raise x
Пример #4
0
def bin(x):
    if isinstance(x, int):
        return _bin(x)
    else:
        if _is_pointZero(x):
            return _bin(int(x))
        else:
            return x
Пример #5
0
def oct(x):
    if isinstance(x, int):
        return _oct(x)
    else:
        if _is_pointZero(x):
            return _oct(int(x))
        else:
            return x
Пример #6
0
def bin(x):
    if isinstance(x, int):
        return _bin(x)
    else:
        if _is_pointZero(x):
            return _bin(int(x))
        else:
            return x
Пример #7
0
def round(x, *dig):     # in parsefuncs.function_handler.used_optlist
    if len(dig) == 0:
        return _round(x)
    else:
        if not _is_pointZero(dig[0]):
            raise MathError('<font color=red>round( )</font> ' +\
                            translate('MathErrors', _errors['oivDig']))
        else:
            return _round(x, int(dig[0]))
Пример #8
0
def round(x, *dig):  # in parsefuncs.function_handler.used_optlist
    if len(dig) == 0:
        return _round(x)
    else:
        if not _is_pointZero(dig[0]):
            raise MathError('<font color=red>round( )</font> ' +\
                            translate('MathErrors', _errors['oivDig']))
        else:
            return _round(x, int(dig[0]))
Пример #9
0
def rt(x, N):
    if _is_pointZero(N) and N >= 2:
        if x < 0:
            if N % 2:
                return _abs(x)**(1/N) * -1
            else:
                raise MathError(translate('MathErrors', _errors['mde']))
        else:
            return x**(1/N)
    else:
        raise MathError(translate('MathErrors', _errors['mde']))
Пример #10
0
def rt(x, N):
    if _is_pointZero(N) and N >= 2:
        if x < 0:
            if N % 2:
                return _abs(x)**(1 / N) * -1
            else:
                raise MathError(translate('MathErrors', _errors['mde']))
        else:
            return x**(1 / N)
    else:
        raise MathError(translate('MathErrors', _errors['mde']))
Пример #11
0
def fact(n):
    if _is_pointZero(n):
        if 0 <= n <= 64:
            return _factorial(n)
        elif n < 0:
            raise MathError('<font color=red>fact()</font> ' +\
                            translate('MathErrors', _errors['nv']))
        else:
            raise MathError('<font color=red>fact()</font> ' +\
                            translate('MathErrors', _errors['fac64']))
    else:
        raise MathError('<font color=red>fact()</font> ' +\
                        translate('MathErrors', _errors['oiv']))
Пример #12
0
def fact(n):
    if _is_pointZero(n):
        if 0 <= n <= 64:
            return _factorial(n)
        elif n < 0:
            raise MathError('<font color=red>fact()</font> ' +\
                            translate('MathErrors', _errors['nv']))
        else:
            raise MathError('<font color=red>fact()</font> ' +\
                            translate('MathErrors', _errors['fac64']))
    else:
        raise MathError('<font color=red>fact()</font> ' +\
                        translate('MathErrors', _errors['oiv']))