MINGW error: truncating instead of rounding

This commit is contained in:
h_vogt 2011-02-15 23:12:03 +00:00
parent 24cdf89344
commit 7e27d6c9ac
2 changed files with 9 additions and 5 deletions

View File

@ -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 :

View File

@ -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;