| 1 |
/*** |
| 2 |
!Test |
| 3 |
check_against: [] |
| 4 |
expected: |
| 5 |
- !Result |
| 6 |
solution: |
| 7 |
- !Solution |
| 8 |
_output_item: -2.00, -2, -2, -2 OK |
| 9 |
x: -2.0 |
| 10 |
- !Solution |
| 11 |
_output_item: -1.75, -1, -2, -2 OK |
| 12 |
x: -1.75 |
| 13 |
- !Solution |
| 14 |
_output_item: -1.50, -1, -2, -2 OK |
| 15 |
x: -1.5 |
| 16 |
- !Solution |
| 17 |
_output_item: -1.25, -1, -2, -1 OK |
| 18 |
x: -1.25 |
| 19 |
- !Solution |
| 20 |
_output_item: -1.00, -1, -1, -1 OK |
| 21 |
x: -1.0 |
| 22 |
- !Solution |
| 23 |
_output_item: -0.25, 0, -1, 0 OK |
| 24 |
x: -0.25 |
| 25 |
- !Solution |
| 26 |
_output_item: -0.00, 0, 0, 0 OK |
| 27 |
x: -0.0 |
| 28 |
status: ALL_SOLUTIONS |
| 29 |
extra_files: [] |
| 30 |
markers: [] |
| 31 |
name: '' |
| 32 |
options: |
| 33 |
all_solutions: true |
| 34 |
solvers: |
| 35 |
- gecode |
| 36 |
type: solve |
| 37 |
|
| 38 |
***/ |
| 39 |
|
| 40 |
var -2.0..0.0: x; |
| 41 |
var int: c = ceil(x); |
| 42 |
var int: f = floor(x); |
| 43 |
var int: r = round(x); |
| 44 |
|
| 45 |
constraint exists(i in [-2.0, -1.75, -1.5, -1.25, -1.0, -0.25, 0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0])(x=i); |
| 46 |
|
| 47 |
output [ format(2, 2, x) ++", \(c), \(f), \(r) " ++ let { |
| 48 |
constraint assert(fix(c)=ceil(fix(x)), "incorrect ceil"); |
| 49 |
constraint assert(fix(f)=floor(fix(x)), "incorrect floor"); |
| 50 |
constraint assert(fix(r)=round(fix(x)), "incorrect round"); } in "OK" ]; |