Home My Page Projects Code Snippets Project Openings diderot
 Summary Activity Tracker Tasks SCM

# SCM Repository

[diderot] View of /tests/rtest/tests/int-arith/int-arith.diderot
 [diderot] / tests / rtest / tests / int-arith / int-arith.diderot # View of /tests/rtest/tests/int-arith/int-arith.diderot

Tue Aug 15 03:04:14 2017 UTC (19 months ago) by jhr
File size: 969 byte(s)
`added regression test`
```#version 2

/* real-arith.diderot
*
* This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
*
* COPYRIGHT (c) 2017 The University of Chicago
*/

/* test various arithmetic operations on reals; these tests are to
* verify that the code generator is producing basically correct
*/

int[] data = { -12, -1, 0, 2, 42 };

initialize {
// +, -, *, /, fmod, min, max
print (data, " + ", data, " = ", data+data, "\n");
print (data, " - ", data, " = ", data-data, "\n");
print (data, " * ", data, " = ", data*data, "\n");
print (data, " / ", data, " = ", data/data, "\n");
print (data, " % ", data, " = ", data%data, "\n");

// test integral operators
foreach (int x in data) {
print ("abs(", x, ") = ", |x|, "\n");
}
}

strand S () {

output int out = 0;

update { stabilize; }

}

create_collection { S() | i in 1..1 }
```

 root@smlnj-gforge.cs.uchicago.edu ViewVC Help Powered by ViewVC 1.0.0