Skip to content
Snippets Groups Projects
Commit b2b2ac74 authored by Pierre Loic Garoche's avatar Pierre Loic Garoche
Browse files

Merge branch 'master' into unstable

parents fb716d2c e4811e4c
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,13 @@ Current Status: [![Build Status](https://travis-ci.org/coco-team/lustrec.svg?
LustreC is a modular compiler of Lustre code into C and Horn Clauses.
# Dependencies
On a fresh ubuntu/debian-like install
> apt-get install opam libmpfr-dev
Get a fresh version of ocaml
> opam switch 4.06.1
Install some dependencies
> opam install depext ocamlgraph mlmpfr num cmdliner fmt logs yojson menhir
# Build
```
> autoconf
......
#include <math.h>
int real_to_int (double in1) { return (int)in1; }
int _Floor (double in1) { return (int)floor(in1); }
double _floor (double in1) { return floor(in1); }
int _Ceiling (double in1) { return (int)ceil(in1); }
double _ceil (double in1) { return ceil(in1); }
int _Round (double in1) { return (int)round(in1); }
double _round (double in1) { return round(in1); }
double int_to_real (int in1) { return (double)in1; }
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;
......@@ -23,4 +23,4 @@ function sinh (x: real) returns (y: real) prototype C lib m;
function sqrt (x: real) returns (y: real) prototype C lib m;
function trunc (x: real) returns (y: real) prototype C lib m;
function tan (x: real) returns (y: real) prototype C lib m;
function tanh (x: real) returns (y: real) prototype C lib m;
......@@ -23,3 +23,4 @@
(declare-rel exp ( Real Real) )
(declare-rel log ( Real Real) )
(declare-rel log10 ( Real Real) )
(declare-rel tanh ( Real Real) )
\ No newline at end of file
......@@ -19,14 +19,19 @@ int mod_int (int x, int y) {
}
double rem_real (double x, double y) {
return fmod(x, y);
if (x == 0.0 || y == 0.0){
return 0.0;
}else{
return fmod(x, y);
}
}
double mod_real (double x, double y) {
double tmp = 0.;
if (y == 0.) { return x; };
if (x == 0.) { return 0; };
tmp = fmod(x, y);
if (y < 0. && tmp > 0.) {
if (y*tmp < 0.) {
return tmp+y;
}
else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment