switched to floating-point math. yell if you think this causes trouble.

SVN revision: 12550
This commit is contained in:
tsauerbeck 2004-12-22 14:41:12 +00:00 committed by tsauerbeck
parent 03f41d8041
commit deafa61660
1 changed files with 5 additions and 5 deletions

View File

@ -148,18 +148,18 @@ static char *
perform_math (char *input)
{
char buf[256];
int res;
double res;
/* FIXME
* This is a bad hack, we're just assuming that the user wants to
* use fixed point arithmetic here :O
* Always apply floating-point arithmetic.
* Does this cause problems for integer parameters?
*
* What we should do is, loop over the string and figure out whether
* there are floating point operands, too and then switch to
* floating point math.
*/
res = my_atoi (input);
snprintf (buf, sizeof (buf), "%i", res);
res = my_atof (input);
snprintf (buf, sizeof (buf), "%lf", res);
return strdup (buf);
}