round to nearest integer, `rawfileprec' `numdgt' `history' if_option() doset()
This commit is contained in:
parent
2968fb3a97
commit
1ec269082c
|
|
@ -1,3 +1,9 @@
|
|||
2011-06-23 Robert Larice
|
||||
* src/frontend/options.c ,
|
||||
* src/frontend/spiceif.c ,
|
||||
* src/frontend/variable.c :
|
||||
round to nearest integer, `rawfileprec' `numdgt' `history' if_option() doset()
|
||||
|
||||
2011-06-23 Robert Larice
|
||||
* src/frontend/evaluate.c :
|
||||
`[]' indexing operator, round index to nearest integer
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ cp_usrset(struct variable *var, bool isset)
|
|||
if ((var->va_type == CP_BOOL) && (isset == FALSE))
|
||||
raw_prec = -1;
|
||||
else if (var->va_type == CP_REAL)
|
||||
raw_prec = (int)(var->va_real);
|
||||
raw_prec = (int)floor(var->va_real + 0.5);
|
||||
else if (var->va_type == CP_NUM)
|
||||
raw_prec = var->va_num;
|
||||
else
|
||||
|
|
@ -305,7 +305,7 @@ cp_usrset(struct variable *var, bool isset)
|
|||
if ((var->va_type == CP_BOOL) && (isset == FALSE))
|
||||
cp_numdgt = -1;
|
||||
else if (var->va_type == CP_REAL)
|
||||
cp_numdgt = (int)(var->va_real);
|
||||
cp_numdgt = (int)floor(var->va_real + 0.5);
|
||||
else if (var->va_type == CP_NUM)
|
||||
cp_numdgt = var->va_num;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ if_option(CKTcircuit *ckt, char *name, enum cp_types type, void *value)
|
|||
if (type == CP_NUM)
|
||||
pval.iValue = *((int *) value);
|
||||
else if (type == CP_REAL)
|
||||
pval.iValue = (int)(*((double *) value));
|
||||
pval.iValue = (int)floor((*(double *)value) + 0.5);
|
||||
else
|
||||
goto badtype;
|
||||
break;
|
||||
|
|
@ -1111,7 +1111,7 @@ doset(CKTcircuit *ckt, int typecode, GENinstance *dev, GENmodel *mod, IFparm *op
|
|||
iptr = nval.v.vec.iVec = NEWN(int, n);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
*iptr++ = (int)(*dptr++);
|
||||
*iptr++ = (int)floor(*dptr++ + 0.5);
|
||||
break;
|
||||
|
||||
case IF_REAL:
|
||||
|
|
@ -1128,7 +1128,7 @@ doset(CKTcircuit *ckt, int typecode, GENinstance *dev, GENmodel *mod, IFparm *op
|
|||
switch (opt->dataType & IF_VARTYPES) {
|
||||
case IF_FLAG:
|
||||
case IF_INTEGER:
|
||||
nval.iValue = (int)(*val->v_realdata);
|
||||
nval.iValue = (int)floor(*val->v_realdata + 0.5);
|
||||
break;
|
||||
|
||||
case IF_REAL:
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ cp_vset(char *varname, enum cp_types type, void *value)
|
|||
else if (eq(copyvarname, "history") && (type == CP_NUM))
|
||||
cp_maxhistlength = v->va_num;
|
||||
else if (eq(copyvarname, "history") && (type == CP_REAL))
|
||||
cp_maxhistlength = (int)(v->va_real);
|
||||
cp_maxhistlength = (int)floor(v->va_real + 0.5);
|
||||
else if (eq(copyvarname, "noclobber"))
|
||||
cp_noclobber = TRUE;
|
||||
else if (eq(varname, "echo")) /*CDHW*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue