On 08/06/2017 08:20 PM, Andrew Makhorin wrote:
>> In the first two cases evaluation of pt precedes evaluation of xt while
>> in the last three cases xt is evaluated before pt. At the moment I
>> cannot say why this happens...
> I'm sure that this happens, because in the first two cases arguments
> passed to a function (I mean C code, not MathProg) are evaluated in one
> order while in the last three cases in some different order. For
> example, to add two linear forms the following statement is used in
> mpl3.c (see line 4754):
> value = linear_comb(mpl,
>            +1.0, eval_formula(mpl, code->arg.arg.x,
>            +1.0, eval_formula(mpl, code->arg.arg.y);
> where the order in which eval_formula is called depends on the platform.

      FORMULA *op1;
      FORMULA *op2;
         case O_ADD:
            /* addition */
            op1 = eval_formula(mpl, code->arg.arg.x);
            op2 = eval_formula(mpl, code->arg.arg.y);
            value = linear_comb(mpl,
               +1.0, op1,
               +1.0, op2);

gives same result on both arm64 and x86-64.

I suggest you change all binary operands.

Best regards

Heinrich Schuchardt

Bug-glpk mailing list

Reply via email to