# \[AMPL 24827\] Unexpected and weir result

**URL:** <https://discuss.ampl.com/t/ampl-24827-unexpected-and-weir-result/760>\
**Category:** Google Group Mirror\
**Created:** [October 13, 2023, 5:35am UTC](https://discuss.ampl.com/t/ampl-24827-unexpected-and-weir-result/760 "2023-10-13T05:35:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmorill](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/dmorill/32/901_2.png) [@dmorill](https://discuss.ampl.com/u/dmorill)\
**Post date:** [October 13, 2023, 5:35am UTC](https://discuss.ampl.com/t/ampl-24827-unexpected-and-weir-result/760/1 "2023-10-13T05:35:27Z")

</div>

Hi AMPLteam,

I am working on a MILP model about aggregate planning. The problem is that at the end I defined two auxiliary variables to save the values of cost (f1) and staff layoffs (f2) and my objective function is a simple subtraction: z: f1 -f2; and the results are very weir:

z = 2129100  
f1 = 2129150  
f2 = 45

As is evident, z is not the subtraction of f1 and f2, there are 5 units that are missing. What’s going on here? Thank you for being so helpful.

I am using Cplex with cplex\_options ‘mipgap 0’; the complete model (mod, dat and run files) is available at: [https://pastebin.com/u3GMF2aw](https://pastebin.com/u3GMF2aw)

Regards,

---

<div class="post-metadata">

**Author:** ![AMPL\_Google\_Group](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@AMPL\_Google\_Group](https://discuss.ampl.com/u/AMPL_Google_Group)\
**Post date:** [October 14, 2023, 2:15pm UTC](https://discuss.ampl.com/t/ampl-24827-unexpected-and-weir-result/760/2 "2023-10-14T14:15:17Z")

</div>

You must be using AMPL’s “display” command to view these values. By default, it shows numbers to 6 significant digits. Thus,

ampl: display 2129150 - 45;  
2129150 - 45 = 2129100

To get a more precise display, set option display\_precision to a higher value:

ampl: option display\_precision 8;  
ampl: display 2129150 - 45;  
2129150 - 45 = 2129105

---

<div class="post-metadata">

**Author:** ![dmorill](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/dmorill/32/901_2.png) [@dmorill](https://discuss.ampl.com/u/dmorill)\
**Post date:** [October 18, 2023, 5:40am UTC](https://discuss.ampl.com/t/ampl-24827-unexpected-and-weir-result/760/3 "2023-10-18T05:40:52Z")

</div>

Hi AMPL team, thank you, that was the problem.
