Changeset 4fc9c7e in tol


Ignore:
Timestamp:
Jul 2, 2012, 9:31:39 PM (14 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
3da496d
Parents:
946360a
Message:

fixes #1576, el hash de fechas se compara con tolerancia 1.0e-7

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@4904 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tol/bbasic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tol/bbasic/dte.cpp

    r946360a r4fc9c7e  
    213213}
    214214
     215//#define TRACE_COMPARE
     216BInt BDate::Compare(const BDate* dte1, const BDate* dte2) {
     217#ifdef TRACE_COMPARE
     218  std::cout << "Compare: " <<  std::endl;
     219  std::cout << "Hash(dte1) = " <<  dte1->Hash() << std::endl;
     220  std::cout << "Hash(dte2) = " <<  dte2->Hash() << std::endl;   
     221#endif
     222  BReal h1 = dte1->Hash();
     223  BReal h2 = dte2->Hash();
     224  BReal dif = h1 - h2;
     225#ifdef TRACE_COMPARE
     226  std::cout << "dif: " << dif << std::endl;
     227  std::cout << "h1 < h2: " << (h1<h2) << std::endl;
     228#endif
     229  BReal dif0 = fabs( dif );
     230  return dif < -1.0e-7 ? -1 : ( dif0 > 1.0e-7 ? 1 : 0 );
     231}
    215232
    216233//--------------------------------------------------------------------
  • tol/bbasic/tol_bdate.h

    r946360a r4fc9c7e  
    329329   * \return Value indicating the lexicographical relation between the dates.
    330330   */
    331   static BInt Compare(const BDate* dte1, const BDate* dte2) {
    332       BReal dif = dte1->Hash() - dte2->Hash();
    333       return dif>0 ? 1 : (dif<0 ? -1 : 0);
    334   }
     331  static BInt Compare(const BDate* dte1, const BDate* dte2);
    335332
    336333  // Support to algebraical operations: dtealgeb.cpp
Note: See TracChangeset for help on using the changeset viewer.