tft_expr.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:FPTuner 作者: soarlab 项目源码 文件源码
def concEval (self, vmap = {}): 
        retv_lhs = self.lhs().concEval(vmap) 
        assert((type(retv_lhs) is int) or (type(retv_lhs) is float) or (isinstance(retv_lhs, Fraction))) 
        retv_rhs = self.rhs().concEval(vmap) 
        assert((type(retv_rhs) is int) or (type(retv_rhs) is float) or (isinstance(retv_rhs, Fraction))) 

        if (self.operator.label == "+"): 
            return (retv_lhs + retv_rhs) 
        elif (self.operator.label == "-"): 
            return (retv_lhs - retv_rhs)
        elif (self.operator.label == "*"): 
            return (retv_lhs * retv_rhs) 
        elif (self.operator.label == "/"): 
            return (retv_lhs / retv_rhs) 
        elif (self.operator.label == "^"): 
            assert(type(retv_rhs) is int) 
            return math.pow(retv_lhs, retv_rhs) 
        else: 
            sys.exit("ERROR: unknown operator found in function \"similar\" of a BinaryExpr")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号