diff --git a/ChangeLog b/ChangeLog index 1dd2c4ade..e9c33f006 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2011-08-09 Robert Larice + * src/main.c + * src/frontend/plotting/graf.c + * src/frontend/plotting/grid.c + * src/frontend/plotting/x11.c + * src/frontend/wdisp/windisp.c + * src/spicelib/analysis/acan.c + * src/spicelib/analysis/dcop.c + * src/spicelib/analysis/dctran.c + * src/spicelib/analysis/dctrcurv.c + * src/spicelib/analysis/distoan.c + * src/spicelib/analysis/pzan.c + * src/spicelib/parser/inpeval.c + * src/spicelib/parser/inpptree.c + rewrite (double)literal --> floating-point-literal + 2011-08-08 Holger Vogt * src/frontend/com_fft.c, src/maths/fft/fftext.c, fftext.h, fftlib.c, fftlib.h, matlib.c, matlib.h: convert float to double diff --git a/src/frontend/plotting/graf.c b/src/frontend/plotting/graf.c index 006e3ae03..69d89568d 100644 --- a/src/frontend/plotting/graf.c +++ b/src/frontend/plotting/graf.c @@ -297,7 +297,7 @@ gr_point(struct dvec *dv, break; case PLOT_COMB: DatatoScreen(currentgraph, - (double) 0, currentgraph->datawindow.ymin, + 0.0, currentgraph->datawindow.ymin, &dummy, &ymin); DevDrawLine(tox, ymin, tox, toy); break; diff --git a/src/frontend/plotting/grid.c b/src/frontend/plotting/grid.c index 60912051f..8b8ed9faa 100644 --- a/src/frontend/plotting/grid.c +++ b/src/frontend/plotting/grid.c @@ -852,7 +852,7 @@ drawpolargrid(GRAPH *graph) DevDrawArc(graph->grid.xaxis.circular.center, graph->grid.yaxis.circular.center, graph->grid.xaxis.circular.radius, - (double) 0.0, 2*M_PI); + 0.0, 2*M_PI); SetLinestyle(1); /* Now draw the circles. */ @@ -1251,7 +1251,7 @@ drawsmithgrid(GRAPH *graph) } else { zheight = gr_radius; } - for (ki[k] = kr[k] = (double) 0; k > 0; k--) { + for (ki[k] = kr[k] = 0.0; k > 0; k--) { (void) sprintf(plab, "%g", rnorm[k]); (void) sprintf(nlab, "-%g", rnorm[k]); arcset(graph, rr[k], kr[k], ir[k], ki[k], pixperunit, diff --git a/src/frontend/plotting/x11.c b/src/frontend/plotting/x11.c index c19e6c38c..318650b98 100644 --- a/src/frontend/plotting/x11.c +++ b/src/frontend/plotting/x11.c @@ -730,7 +730,7 @@ slopelocation(GRAPH *graph, int x0, int y0) angle = RAD_TO_DEG * atan2( fy0, fx0 ); fprintf(stdout, "r0 = %g, a0 = %g\n", sqrt( fx0*fx0 + fy0*fy0 ), - (angle>0)?angle:(double) 360+angle); + (angle>0)?angle:360.0+angle); } diff --git a/src/frontend/wdisp/windisp.c b/src/frontend/wdisp/windisp.c index 85d9e886a..0d3779eee 100644 --- a/src/frontend/wdisp/windisp.c +++ b/src/frontend/wdisp/windisp.c @@ -436,7 +436,7 @@ LRESULT CALLBACK PlotWindowProc( HWND hwnd, angle = RAD_TO_DEG * atan2( fy0, fx0 ); fprintf(stdout, "r0 = %g, a0 = %g\n", sqrt( fx0*fx0 + fy0*fy0 ), - (angle>0)?angle:(double) 360+angle); + (angle>0)?angle:360.0+angle); } } else { /* need to print info about two points */ diff --git a/src/main.c b/src/main.c index 954e1b824..09e7959ce 100644 --- a/src/main.c +++ b/src/main.c @@ -467,7 +467,7 @@ SIMinit(IFfrontEnd *frontEnd, IFsimulator **simulator) CONSTroot2 = sqrt(2.); CONSTvt0 = CONSTboltz * (27 /* deg c */ + CONSTCtoK ) / CHARGE; CONSTKoverQ = CONSTboltz / CHARGE; - CONSTe = exp((double)1.0); + CONSTe = exp(1.0); return(OK); } diff --git a/src/spicelib/analysis/acan.c b/src/spicelib/analysis/acan.c index 1df6ed020..4befbb663 100644 --- a/src/spicelib/analysis/acan.c +++ b/src/spicelib/analysis/acan.c @@ -135,7 +135,7 @@ ACan(CKTcircuit *ckt, int restart) tfree(nameList); ipc_send_dcop_prefix(); - CKTdump(ckt,(double)0,acPlot); + CKTdump(ckt, 0.0, acPlot); ipc_send_dcop_suffix(); SPfrontEnd->OUTendPlot (acPlot); @@ -156,7 +156,7 @@ ACan(CKTcircuit *ckt, int restart) ckt->CKTcurJob, "AC Operating Point", NULL, IF_REAL, numNames, nameList, IF_REAL, &plot); if(error) return(error); - CKTdump(ckt,(double)0,plot); + CKTdump(ckt, 0.0, plot); SPfrontEnd->OUTendPlot (plot); plot = NULL; } diff --git a/src/spicelib/analysis/dcop.c b/src/spicelib/analysis/dcop.c index da88d8b13..35a90ddb3 100644 --- a/src/spicelib/analysis/dcop.c +++ b/src/spicelib/analysis/dcop.c @@ -144,7 +144,7 @@ DCop(CKTcircuit *ckt, int notused) if(g_ipc.enabled) ipc_send_dcop_prefix(); - CKTdump(ckt,(double)0,plot); + CKTdump(ckt, 0.0, plot); if(g_ipc.enabled) ipc_send_dcop_suffix(); @@ -152,7 +152,7 @@ DCop(CKTcircuit *ckt, int notused) /* gtri - end - wbk */ #else if(converged == 0) { - CKTdump(ckt,(double)0,plot); + CKTdump(ckt, 0.0, plot); } else { fprintf(stderr,"error: circuit reload failed.\n"); } diff --git a/src/spicelib/analysis/dctran.c b/src/spicelib/analysis/dctran.c index 07a6a0fa0..839e498f4 100644 --- a/src/spicelib/analysis/dctran.c +++ b/src/spicelib/analysis/dctran.c @@ -256,7 +256,7 @@ DCtran(CKTcircuit *ckt, /* Send the operating point results for Mspice compatibility */ if(g_ipc.enabled) { ipc_send_dcop_prefix(); - CKTdump(ckt,(double)0,(((TRANan*)ckt->CKTcurJob)->TRANplot)); + CKTdump(ckt, 0.0, ((TRANan*)ckt->CKTcurJob)->TRANplot); ipc_send_dcop_suffix(); } diff --git a/src/spicelib/analysis/dctrcurv.c b/src/spicelib/analysis/dctrcurv.c index b56d2a1bb..18ece318f 100644 --- a/src/spicelib/analysis/dctrcurv.c +++ b/src/spicelib/analysis/dctrcurv.c @@ -415,7 +415,7 @@ resume: if(g_ipc.enabled && firstTime) { ipc_send_dcop_prefix(); - CKTdump(ckt,(double) 0,plot); + CKTdump(ckt, 0.0, plot); ipc_send_dcop_suffix(); } diff --git a/src/spicelib/analysis/distoan.c b/src/spicelib/analysis/distoan.c index e18804cc7..cc29eba2d 100644 --- a/src/spicelib/analysis/distoan.c +++ b/src/spicelib/analysis/distoan.c @@ -111,7 +111,7 @@ time1 = SPfrontEnd->IFseconds(); ckt->CKTcurJob, "Distortion Operating Point", NULL, IF_REAL, numNames, nameList, IF_REAL, &acPlot); if(error) return(error); - CKTdump(ckt,(double)0,acPlot); + CKTdump(ckt, 0.0, acPlot); SPfrontEnd->OUTendPlot (acPlot); acPlot = NULL; } diff --git a/src/spicelib/analysis/pzan.c b/src/spicelib/analysis/pzan.c index ff8349805..dd1273465 100644 --- a/src/spicelib/analysis/pzan.c +++ b/src/spicelib/analysis/pzan.c @@ -49,7 +49,7 @@ PZan(CKTcircuit *ckt, int reset) ckt->CKTcurJob, "Distortion Operating Point", NULL, IF_REAL, numNames, nameList, IF_REAL, &plot); if(error) return(error); - CKTdump(ckt,(double)0,plot); + CKTdump(ckt, 0.0, plot); SPfrontEnd->OUTendPlot (plot); } diff --git a/src/spicelib/parser/inpeval.c b/src/spicelib/parser/inpeval.c index e28c9749d..520dfeae3 100644 --- a/src/spicelib/parser/inpeval.c +++ b/src/spicelib/parser/inpeval.c @@ -28,11 +28,11 @@ double INPevaluate(char **line, int *error, int gobble) * errors in v(1,2) exp */ *error = INPgetUTok(line, &token, 0); if (*error) - return ((double) 0.0); + return (0.0); } else if (gobble == 2) { *error = INPgetU2Tok(line, &token, 0); if (*error) - return ((double) 0.0); + return (0.0); } else { token = *line; *error = 0; @@ -176,7 +176,7 @@ double INPevaluate(char **line, int *error, int gobble) *line = here; } return (sign * mantis * - pow((double) 10, + pow(10.0, (double) (expo1 + expsgn * expo2))); } } else if ((*(here + 1) == 'I') || (*(here + 1) == 'i')) { @@ -189,7 +189,7 @@ double INPevaluate(char **line, int *error, int gobble) *line = here; } return (sign * mantis * - pow((double) 10, + pow(10.0, (double) (expo1 + expsgn * expo2))); } } @@ -207,5 +207,5 @@ double INPevaluate(char **line, int *error, int gobble) *line = here; } return (sign * mantis * - pow((double) 10, (double) (expo1 + expsgn * expo2))); + pow(10.0, (double) (expo1 + expsgn * expo2))); } diff --git a/src/spicelib/parser/inpptree.c b/src/spicelib/parser/inpptree.c index f032f3464..5f5d4be1c 100644 --- a/src/spicelib/parser/inpptree.c +++ b/src/spicelib/parser/inpptree.c @@ -174,15 +174,15 @@ static INPparseNode *PTdifferentiate(INPparseNode * p, int varnum) case PT_TEMPERATURE: case PT_FREQUENCY: case PT_CONSTANT: - newp = mkcon((double) 0); + newp = mkcon(0.0); break; case PT_VAR: /* Is this the variable we're differentiating wrt? */ if (p->valueIndex == varnum) - newp = mkcon((double) 1); + newp = mkcon(1.0); else - newp = mkcon((double) 0); + newp = mkcon(0.0); break; case PT_PLUS: @@ -210,7 +210,7 @@ static INPparseNode *PTdifferentiate(INPparseNode * p, int varnum) p->right), mkb(PT_TIMES, p->left, arg2)), - mkb(PT_POWER, p->right, mkcon((double) 2))); + mkb(PT_POWER, p->right, mkcon(2.0))); break; case PT_POWER: @@ -279,76 +279,60 @@ static INPparseNode *PTdifferentiate(INPparseNode * p, int varnum) break; case PTF_SGN: - arg1 = mkcon((double) 0.0); + arg1 = mkcon(0.0); break; case PTF_ACOS: /* - 1 / sqrt(1 - u^2) */ - arg1 = mkb(PT_DIVIDE, mkcon((double) -1), mkf(PTF_SQRT, + arg1 = mkb(PT_DIVIDE, mkcon(-1.0), mkf(PTF_SQRT, mkb(PT_MINUS, - mkcon( - (double) - 1), + mkcon(1.0), mkb(PT_POWER, p->left, - mkcon( - (double) - 2))))); + mkcon(2.0))))); break; case PTF_ACOSH: /* 1 / sqrt(u^2 - 1) */ - arg1 = mkb(PT_DIVIDE, mkcon((double) 1), mkf(PTF_SQRT, + arg1 = mkb(PT_DIVIDE, mkcon(1.0), mkf(PTF_SQRT, mkb(PT_MINUS, mkb(PT_POWER, p->left, - mkcon( - (double) - 2)), - mkcon((double) - 1)))); + mkcon(2.0)), + mkcon(1.0)))); break; case PTF_ASIN: /* 1 / sqrt(1 - u^2) */ - arg1 = mkb(PT_DIVIDE, mkcon((double) 1), mkf(PTF_SQRT, + arg1 = mkb(PT_DIVIDE, mkcon(1.0), mkf(PTF_SQRT, mkb(PT_MINUS, - mkcon((double) - 1), + mkcon(1.0), mkb(PT_POWER, p->left, - mkcon( - (double) - 2))))); + mkcon(2.0))))); break; case PTF_ASINH: /* 1 / sqrt(u^2 + 1) */ - arg1 = mkb(PT_DIVIDE, mkcon((double) 1), mkf(PTF_SQRT, + arg1 = mkb(PT_DIVIDE, mkcon(1.0), mkf(PTF_SQRT, mkb(PT_PLUS, mkb(PT_POWER, p->left, - mkcon( - (double) - 2)), - mkcon((double) - 1)))); + mkcon(2.0)), + mkcon(1.0)))); break; case PTF_ATAN: /* 1 / (1 + u^2) */ - arg1 = mkb(PT_DIVIDE, mkcon((double) 1), mkb(PT_PLUS, + arg1 = mkb(PT_DIVIDE, mkcon(1.0), mkb(PT_PLUS, mkb(PT_POWER, p->left, - mkcon((double) - 2)), - mkcon((double) - 1))); + mkcon(2.0)), + mkcon(1.0))); break; case PTF_ATANH: /* 1 / (1 - u^2) */ - arg1 = mkb(PT_DIVIDE, mkcon((double) 1), mkb(PT_MINUS, - mkcon((double) 1), + arg1 = mkb(PT_DIVIDE, mkcon(1.0), mkb(PT_MINUS, + mkcon(1.0), mkb(PT_POWER, p->left, - mkcon((double) - 2)))); + mkcon(2.0)))); break; case PTF_COS: /* - sin(u) */ @@ -365,11 +349,11 @@ static INPparseNode *PTdifferentiate(INPparseNode * p, int varnum) break; case PTF_LN: /* 1 / u */ - arg1 = mkb(PT_DIVIDE, mkcon((double) 1), p->left); + arg1 = mkb(PT_DIVIDE, mkcon(1.0), p->left); break; case PTF_LOG: /* log(e) / u */ - arg1 = mkb(PT_DIVIDE, mkcon((double) M_LOG10E), p->left); + arg1 = mkb(PT_DIVIDE, mkcon(M_LOG10E), p->left); break; case PTF_SIN: /* cos(u) */ @@ -381,26 +365,24 @@ static INPparseNode *PTdifferentiate(INPparseNode * p, int varnum) break; case PTF_SQRT: /* 1 / (2 * sqrt(u)) */ - arg1 = mkb(PT_DIVIDE, mkcon((double) 1), mkb(PT_TIMES, - mkcon((double) 2), + arg1 = mkb(PT_DIVIDE, mkcon(1.0), mkb(PT_TIMES, + mkcon(2.0), mkf(PTF_SQRT, p->left))); break; case PTF_TAN: /* 1 / (cos(u) ^ 2) */ - arg1 = mkb(PT_DIVIDE, mkcon((double) 1), mkb(PT_POWER, + arg1 = mkb(PT_DIVIDE, mkcon(1.0), mkb(PT_POWER, mkf(PTF_COS, p->left), - mkcon((double) - 2))); + mkcon(2.0))); break; case PTF_TANH: /* 1 / (cosh(u) ^ 2) */ - arg1 = mkb(PT_DIVIDE, mkcon((double) 1), mkb(PT_POWER, + arg1 = mkb(PT_DIVIDE, mkcon(1.0), mkb(PT_POWER, mkf(PTF_COSH, p->left), - mkcon((double) - 2))); + mkcon(2.0))); break; case PTF_USTEP: @@ -410,7 +392,7 @@ static INPparseNode *PTdifferentiate(INPparseNode * p, int varnum) case PTF_LT0: case PTF_GE0: case PTF_LE0: - arg1 = mkcon((double) 0.0); + arg1 = mkcon(0.0); break; case PTF_URAMP: @@ -424,11 +406,11 @@ static INPparseNode *PTdifferentiate(INPparseNode * p, int varnum) mkf(PTF_USTEP, mkb(PT_MINUS, p->left, - mkcon((double) 1.0)))); + mkcon(1.0)))); break; case PTF_UMINUS: /* - 1 ; like a constant (was 0 !) */ - arg1 = mkcon((double) - 1.0); + arg1 = mkcon(-1.0); break; case PTF_PWL: /* PWL(var, x1, y1, x2, y2, ... a const list) */ @@ -437,7 +419,7 @@ static INPparseNode *PTdifferentiate(INPparseNode * p, int varnum) break; case PTF_PWL_DERIVATIVE: /* d/dvar PWL(var, ...) */ - arg1 = mkcon((double) 0.0); + arg1 = mkcon(0.0); break; case PTF_MIN: