| 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 |
- !Solution |
| 29 |
_output_item: 0.00, 0, 0, 0 OK |
| 30 |
x: 0.0 |
| 31 |
- !Solution |
| 32 |
_output_item: 0.25, 1, 0, 0 OK |
| 33 |
x: 0.25 |
| 34 |
- !Solution |
| 35 |
_output_item: 0.50, 1, 0, 1 OK |
| 36 |
x: 0.5 |
| 37 |
- !Solution |
| 38 |
_output_item: 0.75, 1, 0, 1 OK |
| 39 |
x: 0.75 |
| 40 |
- !Solution |
| 41 |
_output_item: 1.00, 1, 1, 1 OK |
| 42 |
x: 1.0 |
| 43 |
- !Solution |
| 44 |
_output_item: 1.25, 2, 1, 1 OK |
| 45 |
x: 1.25 |
| 46 |
- !Solution |
| 47 |
_output_item: 1.50, 2, 1, 2 OK |
| 48 |
x: 1.5 |
| 49 |
- !Solution |
| 50 |
_output_item: 1.75, 2, 1, 2 OK |
| 51 |
x: 1.75 |
| 52 |
- !Solution |
| 53 |
_output_item: 2.00, 2, 2, 2 OK |
| 54 |
x: 2.0 |
| 55 |
status: ALL_SOLUTIONS |
| 56 |
extra_files: [] |
| 57 |
markers: [] |
| 58 |
name: '' |
| 59 |
options: |
| 60 |
all_solutions: true |
| 61 |
solvers: |
| 62 |
- gecode |
| 63 |
type: solve |
| 64 |
|
| 65 |
***/ |
| 66 |
|
| 67 |
var -2.0..2.0: x; |
| 68 |
var int: c = ceil(x); |
| 69 |
var int: f = floor(x); |
| 70 |
var int: r = round(x); |
| 71 |
|
| 72 |
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); |
| 73 |
|
| 74 |
output [ format(2, 2, x) ++ ", \(c), \(f), \(r) " ++ let { |
| 75 |
constraint assert(fix(c)=ceil(fix(x)), "incorrect ceil"); |
| 76 |
constraint assert(fix(f)=floor(fix(x)), "incorrect floor"); |
| 77 |
constraint assert(fix(r)=round(fix(x)), "incorrect round"); } in "OK" ]; |