checking for overflow in integer literals
fixing FLT_EPSILON
This commit is contained in:
parent
0bbfb48b9c
commit
3f4b26a46f
|
@ -11,7 +11,7 @@ LLT = $(LLTDIR)/libllt.a
|
||||||
|
|
||||||
# OS flags: LINUX, WIN32, MACOSX
|
# OS flags: LINUX, WIN32, MACOSX
|
||||||
# architecture flags: __CPU__=xxx, BITS64, ARCH_X86, ARCH_X86_64
|
# 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)
|
FLAGS = -falign-functions -Wall -Wno-strict-aliasing -I$(LLTDIR) $(CFLAGS) -DUSE_COMPUTED_GOTO $(CONFIG)
|
||||||
LIBFILES = $(LLT)
|
LIBFILES = $(LLT)
|
||||||
LIBS = $(LIBFILES) -lm
|
LIBS = $(LIBFILES) -lm
|
||||||
|
|
|
@ -60,11 +60,17 @@ int isnumtok_base(char *tok, value_t *pval, int base)
|
||||||
if (pval) *pval = mk_double(D_NINF);
|
if (pval) *pval = mk_double(D_NINF);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
errno = 0;
|
||||||
i64 = strtoll(tok, &end, base);
|
i64 = strtoll(tok, &end, base);
|
||||||
|
if (errno)
|
||||||
|
return 0;
|
||||||
if (pval) *pval = return_from_int64(i64);
|
if (pval) *pval = return_from_int64(i64);
|
||||||
return (*end == '\0');
|
return (*end == '\0');
|
||||||
}
|
}
|
||||||
|
errno = 0;
|
||||||
ui64 = strtoull(tok, &end, base);
|
ui64 = strtoull(tok, &end, base);
|
||||||
|
if (errno)
|
||||||
|
return 0;
|
||||||
if (pval) *pval = return_from_uint64(ui64);
|
if (pval) *pval = return_from_uint64(ui64);
|
||||||
return (*end == '\0');
|
return (*end == '\0');
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ TESTER = llttest
|
||||||
|
|
||||||
# OS flags: LINUX, WIN32, MACOSX
|
# OS flags: LINUX, WIN32, MACOSX
|
||||||
# architecture flags: __CPU__=xxx, BITS64, ARCH_X86, ARCH_X86_64
|
# 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)
|
FLAGS = -Wall -Wno-strict-aliasing $(CFLAGS) $(CONFIG)
|
||||||
LIBS =
|
LIBS =
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ typedef u_ptrint_t uptrint_t;
|
||||||
#define BIT31 0x80000000
|
#define BIT31 0x80000000
|
||||||
|
|
||||||
#define DBL_EPSILON 2.2204460492503131e-16
|
#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_MAX 1.7976931348623157e+308
|
||||||
#define DBL_MIN 2.2250738585072014e-308
|
#define DBL_MIN 2.2250738585072014e-308
|
||||||
#define FLT_MAX 3.402823466e+38
|
#define FLT_MAX 3.402823466e+38
|
||||||
|
|
Loading…
Reference in New Issue