Skip to content

Commit 8255861

Browse files
committed
Better defaults for floats
- mantissa wide enough for double - default tolerance at 1e-9 - (explicit int to silence compiler warning)
1 parent 42c36ad commit 8255861

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ HFILES=misc.h strings.h line.h float.h floatrep.h tol.h command.h comment.h toke
7979
OTHER=README Makefile Sample.1 Sample.2 Sample.3 Sample.4 paper.ms paper.out
8080
MANPAGE=spiff.1
8181

82-
CFLAGS= $(OSFLAG) $(TFLAG) $(VISFLAG) -DNOCHATTER
82+
CFLAGS=$(OSFLAG) $(TFLAG) $(VISFLAG) -DNOCHATTER
8383

8484
default: spiff
8585

float.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ F_floatsub(p1,p2)
367367
F_float p1,p2;
368368
{
369369
static F_float result;
370-
static needinit = 1;
370+
static int needinit = 1;
371371
static char man1[R_MANMAX],man2[R_MANMAX],diff[R_MANMAX];
372372
int exp1,exp2;
373373
char *diffptr,*big,*small;

floatrep.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
** when evaluated to a string, the fractional part will
1919
** not exceed this length
2020
*/
21-
#define R_MANMAX 200
21+
#define R_MANMAX 330 //accommodates max exponent of a double
2222

2323
#define R_POSITIVE 0
2424
#define R_NEGATIVE 1

tol.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ typedef struct _T_tstr{
2626
#define _T_TOLMAX 10 /* number of tolerances that can
2727
be in effect at one time */
2828

29-
#define _T_ADEF "1e-10" /* default absolute tolerance */
30-
#define _T_RDEF "1e-10" /* default relative tolerance */
29+
#define _T_ADEF "1e-9" /* default absolute tolerance */
30+
#define _T_RDEF "1e-9" /* default relative tolerance */
3131

3232
extern T_tol T_gettol();
3333
extern void T_clear_tols();

0 commit comments

Comments
 (0)