Пример #1
0
def evalf_piecewise(expr, prec, options):
    if 'subs' in options:
        expr = expr.subs(options['subs'])
        del options['subs']
        if hasattr(expr, 'func'):
            return evalf(expr, prec, options)
        if type(expr) == float:
            return evalf(C.Float(expr), prec, options)
        if type(expr) == int:
            return evalf(C.Integer(expr), prec, options)

    # We still have undefined symbols
    raise NotImplementedError
Пример #2
0
 def ceiling(self):
     return C.Integer(int(mlib.to_int(mlib.mpf_ceil(self._mpf_, self._prec))))
Пример #3
0
 def floor(self):
     return C.Integer(int(mlib.to_int(mlib.mpf_floor(self._mpf_, self._prec))))