move definition of MAXBIGINT_DOUBLE to variable.cpp

This commit is contained in:
Axel Kohlmeyer
2023-02-14 15:37:59 -05:00
parent 9c7ba5a329
commit d13634cd6b
2 changed files with 8 additions and 6 deletions

View File

@ -95,8 +95,6 @@ typedef int64_t bigint;
#define MAXSMALLINT INT_MAX #define MAXSMALLINT INT_MAX
#define MAXTAGINT INT_MAX #define MAXTAGINT INT_MAX
#define MAXBIGINT INT64_MAX #define MAXBIGINT INT64_MAX
// INT64_MAX cannot be represented with a double. reduce to avoid overflow when casting back.
#define MAXBIGINT_DOUBLE (INT64_MAX-512)
#define MPI_LMP_TAGINT MPI_INT #define MPI_LMP_TAGINT MPI_INT
#define MPI_LMP_IMAGEINT MPI_INT #define MPI_LMP_IMAGEINT MPI_INT
@ -134,8 +132,6 @@ typedef int64_t bigint;
#define MAXSMALLINT INT_MAX #define MAXSMALLINT INT_MAX
#define MAXTAGINT INT64_MAX #define MAXTAGINT INT64_MAX
#define MAXBIGINT INT64_MAX #define MAXBIGINT INT64_MAX
// INT64_MAX cannot be represented with a double. reduce to avoid overflow when casting back.
#define MAXBIGINT_DOUBLE (INT64_MAX-512)
#define MPI_LMP_TAGINT MPI_LL #define MPI_LMP_TAGINT MPI_LL
#define MPI_LMP_IMAGEINT MPI_LL #define MPI_LMP_IMAGEINT MPI_LL
@ -172,7 +168,6 @@ typedef int bigint;
#define MAXSMALLINT INT_MAX #define MAXSMALLINT INT_MAX
#define MAXTAGINT INT_MAX #define MAXTAGINT INT_MAX
#define MAXBIGINT INT_MAX #define MAXBIGINT INT_MAX
#define MAXBIGINT_DOUBLE INT_MAX
#define MPI_LMP_TAGINT MPI_INT #define MPI_LMP_TAGINT MPI_INT
#define MPI_LMP_IMAGEINT MPI_INT #define MPI_LMP_IMAGEINT MPI_INT

View File

@ -73,7 +73,14 @@ enum{DONE,ADD,SUBTRACT,MULTIPLY,DIVIDE,CARAT,MODULO,UNARY,
enum{SUM,XMIN,XMAX,AVE,TRAP,SLOPE}; enum{SUM,XMIN,XMAX,AVE,TRAP,SLOPE};
#define BIG 1.0e20 static constexpr double BIG = 1.0e20;
// INT64_MAX cannot be represented with a double. reduce to avoid overflow when casting back.
#if defined(LAMMPS_SMALLBIG) || defined(LAMMPS_BIGBIG)
static constexpr double MAXBIGINT_DOUBLE = (double) (MAXBIGINT-512);
#else
static constexpr double MAXBIGINT_DOUBLE = (double) MAXBIGINT;
#endif
// constants for variable expressions. customize by adding new items. // constants for variable expressions. customize by adding new items.
// if needed (cf. 'version') initialize in Variable class constructor. // if needed (cf. 'version') initialize in Variable class constructor.