From 1b6b1b2dcf020ca151dcc91f15963c24ad8ee111 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 9 Jan 2008 15:39:05 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1356 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/variable.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/variable.cpp b/src/variable.cpp index f315ceb387..8298fecf66 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -565,9 +565,13 @@ double Variable::evaluate(char *str, Tree **tree) // istop = end of number, including scientific notation int istart = i; - int istop = istart + strspn(&str[i],"0123456789eE.-") - 1; - while (str[istop] == '-') istop--; - i = istop + 1; + while (isdigit(str[i]) || str[i] == '.') i++; + if (str[i] == 'e' || str[i] == 'E') { + i++; + if (str[i] == '+' || str[i] == '-') i++; + while (isdigit(str[i])) i++; + } + int istop = i - 1; int n = istop - istart + 1; char *number = new char[n+1];