diff --git a/include/conv.lusi b/include/conv.lusi index 6fec9a0ffcae08885147708414ec4d70fae39f5a..bd531118b359592996ca6122a5542412898d7515 100644 --- a/include/conv.lusi +++ b/include/conv.lusi @@ -1,9 +1,10 @@ function real_to_int (in1: real) returns (out: int) prototype C; -function _Floor (in1: real) returns (out: int) prototype C; -function _floor (in1: real) returns (out: real) prototype C; -function _Ceiling (in1: real) returns (out: int) prototype C; -function _ceil (in1: real) returns (out: real) prototype C; -function _Round (in1: real) returns (out: int) prototype C; -function _round (in1: real) returns (out: real) prototype C; - function int_to_real (in1: int) returns (out: real) prototype C; + +function _Floor (in1: real) returns (out: int) prototype C lib m; +function _floor (in1: real) returns (out: real) prototype C lib m; +function _Ceiling (in1: real) returns (out: int) prototype C lib m; +function _ceil (in1: real) returns (out: real) prototype C lib m; +function _Round (in1: real) returns (out: int) prototype C lib m; +function _round (in1: real) returns (out: real) prototype C lib m; + diff --git a/include/mpfr_lustre.c b/include/mpfr_lustre.c index 3d32f624ee7fbe7b1fb64b7df42319a792fdb373..bea22e579fbc4d89533f675dfa932d0631b7692a 100644 --- a/include/mpfr_lustre.c +++ b/include/mpfr_lustre.c @@ -95,6 +95,12 @@ void MPFRClear(mpfr_t i) mpfr_clear(i); } +// functions of conv + +void MPFRint_to_real_step (int i, mpfr_t out) +{ + mpfr_set_si(out, i, MPFR_RNDN); +} // functions of lustrec_math void MPFRacos_step (mpfr_t i, mpfr_t out diff --git a/include/mpfr_lustre.lusi b/include/mpfr_lustre.lusi index 6f0e2c3a41cb873e5a88e4e35fd703baacadcc01..801d53af29c699e534b8a5b1873a6f877cf7fb41 100644 --- a/include/mpfr_lustre.lusi +++ b/include/mpfr_lustre.lusi @@ -20,6 +20,9 @@ function MPFREq(i1, i2: real) returns (out: bool); function MPFRNeq(i1, i2: real) returns (out: bool); +-- Functions already available in conv +function MPFRint_to_real (x: int) returns (y: real); + -- Functions already available in lustrec_math function MPFRacos (x: real) returns (y: real) ; diff --git a/src/plugins/mpfr/mpfr.ml b/src/plugins/mpfr/mpfr.ml index a3a523e7baeb51bfaeb09efe79f40e0abfa54bcf..76ea13bf6f97927f520bfa4de2775f202e932f60 100644 --- a/src/plugins/mpfr/mpfr.ml +++ b/src/plugins/mpfr/mpfr.ml @@ -97,6 +97,8 @@ let base_inject_op id = | ">" -> "MPFRGt" | "=" -> "MPFREq" | "!=" -> "MPFRNeq" + (* Conv functions *) + | "int_to_real" -> "MPFRint_to_real" (* Math library functions *) | "acos" -> "MPFRacos" | "acosh" -> "MPFRacosh"