From 7e27d6c9ac116d5da5d4c2babaa104aafe06810b Mon Sep 17 00:00:00 2001 From: h_vogt Date: Tue, 15 Feb 2011 23:12:03 +0000 Subject: [PATCH] MINGW error: truncating instead of rounding --- ChangeLog | 4 ++++ src/spicelib/parser/inpfindl.c | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d41f7821f..787f2d282 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-02-15 Holger Vogt + * spicelib/parser/inpfindl.c:41 with MINGW level=4.00000e000 + returned 3 instead of 4 at INPevaluate() line 210 + 2011-02-13 Robert Larice * src/frontend/numparam/spicenum.c , * src/frontend/numparam/xpressn.c : diff --git a/src/spicelib/parser/inpfindl.c b/src/spicelib/parser/inpfindl.c index e6de6897f..34d09f0d9 100644 --- a/src/spicelib/parser/inpfindl.c +++ b/src/spicelib/parser/inpfindl.c @@ -7,7 +7,7 @@ Modified: 1999 Paolo Nenzi - Now we can use a two digits level code - /* INPfindLev(line,level) * find the 'level' parameter on the given line and return its * value (1,2,..,99 for now, 1 default) - * + * */ #include "ngspice.h" @@ -30,15 +30,15 @@ char *INPfindLev(char *line, int *level) where += 5; /* skip the level keyword */ while ((*where == ' ') || (*where == '\t') || (*where == '=') || (*where == ',') || (*where == '(') || (*where == ')') || - (*where == '+')) + (*where == '+')) { /* legal white space - ignore */ where++; } - /* now the magic number, + /* now the magic number, allow scientific notation of level, e.g. 4.900e1, - offers only limited error checking. + offers only limited error checking. */ - *level = (int)INPevaluate(&where, &error1, 0); + *level = (int)(INPevaluate(&where, &error1, 0) + 0.5); if (*level < 0) { *level = 1;