Skip to content

Commit 2f60bcb

Browse files
author
Christoph M. Wintersteiger
committed
Clean up NaN return values in Z3_get_numeral_double
1 parent 423fb73 commit 2f60bcb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/api/api_numeral.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Module Name:
1515
Revision History:
1616
1717
--*/
18+
#include<cmath>
1819
#include<iostream>
1920
#include "api/z3.h"
2021
#include "api/api_log_macros.h"
@@ -233,7 +234,7 @@ extern "C" {
233234
RESET_ERROR_CODE();
234235
if (!is_expr(a)) {
235236
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
236-
return 0.0/0.0;
237+
return NAN;
237238
}
238239
expr* e = to_expr(a);
239240
fpa_util & fu = mk_c(c)->fpautil();
@@ -242,7 +243,7 @@ extern "C" {
242243
tmp.get().get_ebits() > 11 ||
243244
tmp.get().get_sbits() > 53) {
244245
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
245-
return 0.0/0.0;
246+
return NAN;
246247
}
247248
return fu.fm().to_double(tmp);
248249
}

0 commit comments

Comments
 (0)