checking for overflow in integer literals

fixing FLT_EPSILON
This commit is contained in:
JeffBezanson 2011-08-16 19:59:46 +00:00
parent 0bbfb48b9c
commit 3f4b26a46f
5 changed files with 9 additions and 4 deletions

View File

@ -11,7 +11,7 @@ LLT = $(LLTDIR)/libllt.a
# OS flags: LINUX, WIN32, MACOSX
# architecture flags: __CPU__=xxx, BITS64, ARCH_X86, ARCH_X86_64
CONFIG = -DLINUX -DARCH_X86 -D__CPU__=586
CONFIG = -DLINUX -DARCH_X86_64 -DBITS64 -D__CPU__=686
FLAGS = -falign-functions -Wall -Wno-strict-aliasing -I$(LLTDIR) $(CFLAGS) -DUSE_COMPUTED_GOTO $(CONFIG)
LIBFILES = $(LLT)
LIBS = $(LIBFILES) -lm

View File

@ -60,11 +60,17 @@ int isnumtok_base(char *tok, value_t *pval, int base)
if (pval) *pval = mk_double(D_NINF);
return 1;
}
errno = 0;
i64 = strtoll(tok, &end, base);
if (errno)
return 0;
if (pval) *pval = return_from_int64(i64);
return (*end == '\0');
}
errno = 0;
ui64 = strtoull(tok, &end, base);
if (errno)
return 0;
if (pval) *pval = return_from_uint64(ui64);
return (*end == '\0');
}

View File

@ -12,7 +12,7 @@ TESTER = llttest
# OS flags: LINUX, WIN32, MACOSX
# architecture flags: __CPU__=xxx, BITS64, ARCH_X86, ARCH_X86_64
CONFIG = -DLINUX -DARCH_X86 -D__CPU__=586
CONFIG = -DLINUX -DARCH_X86_64 -DBITS64 -D__CPU__=686
FLAGS = -Wall -Wno-strict-aliasing $(CFLAGS) $(CONFIG)
LIBS =

View File

@ -156,7 +156,7 @@ typedef u_ptrint_t uptrint_t;
#define BIT31 0x80000000
#define DBL_EPSILON 2.2204460492503131e-16
#define FLT_EPSILON 1.1920928e-7
#define FLT_EPSILON 1.192092896e-7
#define DBL_MAX 1.7976931348623157e+308
#define DBL_MIN 2.2250738585072014e-308
#define FLT_MAX 3.402823466e+38

View File

@ -47,7 +47,6 @@ static inline int64_t llabs(int64_t j)
return NBABS(j, 64);
}
#else
extern int64_t llabs(int64_t j);
#endif
int dbl_equals(double a, double b)