Changeset 14230


Ignore:
Timestamp:
Nov 29, 2019 1:40:39 PM (6 days ago)
Author:
Jesper Mattsson
Message:

Merged to release branch. (#5881)

Location:
branches/2.16.x
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/2.16.x

  • branches/2.16.x/CHANGELOG.txt

    r14210 r14230  
    11================= Unreleased ==================
     2; Fixed ; Minor ; Compiler ; #5881
     3Fixed bug where constant evaluation of external functions could result
     4in loss of precision when returning values smaller than 1.
     5
    26; Change ; Minor ; Compiler ; #5883
    37Array assignments in functions are now kept as composite rather than
  • branches/2.16.x/Python/src/tests_jmodelica/files/Modelica/ExtFunctionTests.mo

    r13908 r14230  
    407407      end fRealScalar;
    408408     
     409      function fRealScalarSmall
     410        input  Real x_in;
     411        output Real x_out;
     412      external "C" annotation(
     413        Library="externalFunctionsC",
     414        Include="#include \"externalFunctionsC.h\"");
     415      end fRealScalarSmall;
     416     
    409417      function fRealArray
    410418        input  Real[2] x_in;
     
    424432
    425433      constant Real    xScalar        = fRealScalar(3);
     434      constant Real    xScalarSmall   = fRealScalarSmall(1.234546789012345);
    426435      constant Real[2] xArray         = fRealArray({4,5});
    427436      constant Real[2] xArrayUnknown  = fRealArrayUnknown({6,7});
  • branches/2.16.x/Python/src/tests_jmodelica/files/Modelica/Resources/Include/externalFunctionsC.h

    r9447 r14230  
    55
    66double fRealScalar(double in);
     7double fRealScalarSmall(double in);
    78int fIntegerScalar(int in);
    89int fEnumScalar(int in);
  • branches/2.16.x/Python/src/tests_jmodelica/files/Modelica/Resources/src/externalFunctionsC.c

    r11746 r14230  
    99    return in*3.14;
    1010}
     11
     12
     13double fRealScalarSmall(double in)
     14{
     15    return in / 1.0e6;
     16}
     17
    1118
    1219void fRealArray(double* in, size_t in_d1, double* out, size_t out_d1)
  • branches/2.16.x/Python/src/tests_jmodelica/general/test_extfunctions.py

    r14208 r14230  
    599599        res = model.simulate()
    600600        nose.tools.assert_equals(res.final('xScalar'), 3*3.14)
     601        nose.tools.assert_equals(res.final('xScalarSmall'), 1.234546789012345 / 1e6)
    601602        nose.tools.assert_equals(res.final('xArray[2]'), 4)
    602603        nose.tools.assert_equals(res.final('xArrayUnknown[2]'), 6)
     
    769770          for j in range(1,4):
    770771            x = 'out[{0},{1}]'.format(i,j)
    771             nose.tools.assert_almost_equals(resSim.final(x), resConst.final(x), places=13)
     772            nose.tools.assert_equals(resSim.final(x), resConst.final(x))
    772773        nose.tools.assert_equals(resSim.final('a'), resConst.final('a'))
    773774        nose.tools.assert_equals(resSim.final('b'), resConst.final('b'))
  • branches/2.16.x/RuntimeLibrary/src

  • branches/2.16.x/RuntimeLibrary/src/evaluator/jmi_evaluator_util.h

    r13602 r14230  
    6363
    6464/* Format specifier when printing jmi_real_t */
    65 #define JMCEVAL_realFormat "%.16f"
     65#define JMCEVAL_realFormat "%.17e"
    6666
    6767/* Parses ND dimensions into dimension buffer d*/
Note: See TracChangeset for help on using the changeset viewer.