source: CIVL/examples/arithmetic/floor.c

main
Last change on this file was 05a4f7e, checked in by Stephen Siegel <siegel@…>, 44 hours ago

Added support for "floor", which is now supported by SMT-LIB2.
Fixed simple bug in transformation: in MPI transformer, math.h was being
moved to file scope, but not math.cvl. Now it is, and the one MPI prime
test that was failing now passes.

  • Property mode set to 100644
File size: 417 bytes
Line 
1#include <assert.h>
2#include <math.h>
3
4int main(void) {
5 double x = floor(2.5);
6 assert(x == 2.0);
7 double y = floor(-2.5);
8 assert(y == -3.0);
9 assert(ceil(2.5) == 3.0);
10 assert(ceil(-2.5) == -2.0);
11 assert(floor(2.0) == 2.0);
12 assert(floor(-2.0) == -2.0);
13 assert(ceil(2.0) == 2.0);
14 assert(ceil(-2.0) == -2.0);
15
16 x = 2.71828;
17 int a = x;
18 assert(a == 2);
19 x = -2.71828;
20 a = x;
21 assert(a == -2);
22}
Note: See TracBrowser for help on using the repository browser.