let frama_C_sqrt state actuals =
match actuals with
[_, arg, _] -> begin
let r =
try
let i = Cvalue.V.project_ival arg in
let f = Ival.project_float i in
let result_alarm, f =
Ival.Float_abstract.sqrt_float (get_rounding_mode()) f
in
if result_alarm
then
Value_parameters.result ~once:true ~current:true
"float sqrt: assert (Ook)";
Cvalue.V.inject_ival (Ival.inject_float f)
with
Cvalue.V.Not_based_on_null ->
Value_parameters.result ~once:true ~current:true
"float sqrt applied to address";
Cvalue.V.topify_arith_origin arg
| Ival.Float_abstract.Bottom ->
Value_parameters.warning ~once:true ~current:true
"sqrt: TODO -- a proper alarm";
V.bottom
in
(wrap_double r), state, Location_Bits.Top_Param.bottom
end
| _ -> Value_parameters.error
"Invalid argument for Frama_C_sqrt function";
do_degenerate None;
raise Db.Value.Aborted