简体   繁体   English

在z3py中使用余数运算时出错

[英]Error when using remainder operation in z3py

Doing a remainder operation gives an error in z3py code 进行余数运算会在z3py代码中给出错误

Following is my code 以下是我的代码

    x = Real("x")
    solve( x%2 == 3 )

The Code gives the following Error : 该代码给出以下错误:

    z3.z3types.Z3Exception: Z3 integer expression expected

whereas when I am doing division operation it is working perfectly 而当我进行除法运算时,它运行良好

    solve( x/2 == 3 )

(It gives an answer of 6) (答案为6)

Is remainder operation not supported in z3? z3中不支持余数运算吗? If it is how can achieve it? 如果是怎么能做到呢?

Modulus for a real-value doesn't make sense; 实数的模量没有意义; as real-valued division is precise. 因为实值除法是精确的。

It does make sense for integers. 对于整数确实有意义。 Is that what you intended? 那是你想要的吗? (Note your definition of x being Real .) (请注意,您对x的定义为Real 。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM