mirror of
https://github.com/Z3Prover/z3
synced 2025-06-29 17:38:45 +00:00
Added int to float conversion.
This commit is contained in:
parent
a792790882
commit
9cbf45f689
2 changed files with 22 additions and 8 deletions
|
@ -521,14 +521,26 @@ func_decl * fpa_decl_plugin::mk_to_fp(decl_kind k, unsigned num_parameters, para
|
|||
symbol name("to_fp");
|
||||
return m_manager->mk_func_decl(name, arity, domain, fp, func_decl_info(m_family_id, k, num_parameters, parameters));
|
||||
}
|
||||
else if (arity == 2 &&
|
||||
is_sort_of(domain[0], m_family_id, ROUNDING_MODE_SORT) &&
|
||||
is_sort_of(domain[1], m_arith_fid, INT_SORT)) {
|
||||
// Rounding + 1 Int -> 1 FP
|
||||
if (!(num_parameters == 2 && parameters[0].is_int() && parameters[1].is_int()))
|
||||
m_manager->raise_exception("expecting two integer parameters to to_fp");
|
||||
|
||||
sort * fp = mk_float_sort(parameters[0].get_int(), parameters[1].get_int());
|
||||
symbol name("to_fp");
|
||||
return m_manager->mk_func_decl(name, arity, domain, fp, func_decl_info(m_family_id, k, num_parameters, parameters));
|
||||
}
|
||||
else {
|
||||
m_manager->raise_exception("Unexpected argument combination for (_ to_fp eb sb). Supported argument combinations are: "
|
||||
"((_ BitVec 1) (_ BitVec eb) (_ BitVec sb-1)),"
|
||||
"(_ BitVec (eb+sb)),"
|
||||
"(Real),"
|
||||
"(RoundingMode (_ BitVec (eb+sb))),"
|
||||
"(RoundingMode (_ FloatingPoint eb' sb')),"
|
||||
"(RoundingMode Real Int), and"
|
||||
"((_ BitVec 1) (_ BitVec eb) (_ BitVec sb-1)), "
|
||||
"(_ BitVec (eb+sb)), "
|
||||
"(Real), "
|
||||
"(RoundingMode (_ BitVec (eb+sb))), "
|
||||
"(RoundingMode (_ FloatingPoint eb' sb')), "
|
||||
"(RoundingMode Real Int), "
|
||||
"(RoundingMode Int), and "
|
||||
"(RoundingMode Real)."
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue