Z3: Convert between FP and BitVector?

柔情痞子 提交于 2019-12-24 03:10:00

问题


Is there any way to convert between BitVector and FP in SMTLIB2, something like the int2bv and bv2int functions?

To clarify, I am looking for a raw representation of the bits, not e.g., a rounded integer in BitVec form.


回答1:


To be precise, there is no standard for floating point arithmetic in SMTLIB yet. There is a draft for this which will be finalized at a later point in time; this draft does not contain such functions at the moment. However, Z3 does support such conversion functions when the QF_FPABV logic is enabled.

These functions are called

asIEEEBV (takes a float and returns a BV in IEEE764 format of appropriate size)

and

fromIEEEBV (takes a BV in IEEE764 format and returns a float of appropriate size)


来源:https://stackoverflow.com/questions/16841212/z3-convert-between-fp-and-bitvector

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!