ref: 3f4b26a46f907a6c4641512a6e3d6f4c90937f69
parent: 0bbfb48b9c171339a174ee9dbc7a60c89debc52f
author: JeffBezanson <jeff.bezanson@gmail.com>
date: Tue Aug 16 15:59:46 EDT 2011
checking for overflow in integer literals fixing FLT_EPSILON
--- a/femtolisp/Makefile
+++ b/femtolisp/Makefile
@@ -11,7 +11,7 @@
# 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
--- a/femtolisp/read.c
+++ b/femtolisp/read.c
@@ -60,11 +60,17 @@
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');
}
--- a/llt/Makefile
+++ b/llt/Makefile
@@ -12,7 +12,7 @@
# 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 =
--- a/llt/dtypes.h
+++ b/llt/dtypes.h
@@ -156,7 +156,7 @@
#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
--- a/llt/fp.c
+++ b/llt/fp.c
@@ -47,7 +47,6 @@
return NBABS(j, 64);
}
#else
-extern int64_t llabs(int64_t j);
#endif
int dbl_equals(double a, double b)