Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14809


Ignore:
Timestamp:
03/31/17 14:36:43 (7 years ago)
Author:
bburlacu
Message:

#2442: Update SymbolicDataAnalysisExpressionTreeILEmittingInterpreter with explicit conversions to ensure correct results.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs

    r14185 r14809  
    259259              il.Emit(System.Reflection.Emit.OpCodes.Add);
    260260            }
    261             il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, nArgs);
     261            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, (double)nArgs);
    262262            il.Emit(System.Reflection.Emit.OpCodes.Div);
    263263            return;
     
    457457            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); // > 0
    458458            il.Emit(System.Reflection.Emit.OpCodes.Cgt);
     459            il.Emit(System.Reflection.Emit.OpCodes.Conv_R8); // convert to float64
    459460            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // * 2
    460461            il.Emit(System.Reflection.Emit.OpCodes.Mul);
     
    475476              il.Emit(System.Reflection.Emit.OpCodes.Xor);
    476477            }
     478            il.Emit(System.Reflection.Emit.OpCodes.Conv_R8); // convert to float64
     479
    477480            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // * 2
    478481            il.Emit(System.Reflection.Emit.OpCodes.Mul);
     
    486489
    487490            il.Emit(System.Reflection.Emit.OpCodes.Cgt); // 1 (>) / 0 (otherwise)
     491            il.Emit(System.Reflection.Emit.OpCodes.Conv_R8); // convert to float64
    488492            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // * 2
    489493            il.Emit(System.Reflection.Emit.OpCodes.Mul);
     
    496500            CompileInstructions(il, state, ds);
    497501            il.Emit(System.Reflection.Emit.OpCodes.Clt);
     502            il.Emit(System.Reflection.Emit.OpCodes.Conv_R8); // convert to float64
    498503            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // * 2
    499504            il.Emit(System.Reflection.Emit.OpCodes.Mul);
Note: See TracChangeset for help on using the changeset viewer.