Commit 8af17ae9 authored by Anton Ertl's avatar Anton Ertl

represent bug fixed

parent 50b76baa
......@@ -1227,7 +1227,7 @@ AC_CHECK_FUNC(getopt_long,[true],[AC_LIBOBJ(getopt) AC_LIBOBJ(getopt1)])
AC_CHECK_FUNCS(expm1 log1p)
AC_CHECK_FUNCS(mcheck mprobe)
AC_REPLACE_FUNCS(rint)
if test $machine = 386 || test $machine = arm
if false && (test $machine = 386 || test $machine = arm)
then
test -z "$ac_cv_func_ecvt_r" && ac_cv_func_ecvt_r=no
AC_REPLACE_FUNCS(ecvt_r)
......
......@@ -594,7 +594,7 @@ struct Cellpair file_status(Char *c_addr, UCell u)
return r;
}
static void repstr(Address s, Address t, UCell u)
static void repstr(char * s, char * t, UCell u)
{
UCell slen = strlen(s);
if (slen>u)
......@@ -603,13 +603,14 @@ static void repstr(Address s, Address t, UCell u)
memset(t+slen,' ',u-slen);
}
struct Cellpair represent(Float r, Address c_addr, UCell u, Cell *np)
struct Cellpair represent(Float r, Address c_addr1, UCell u, Cell *np)
{
Cell ok, sign, decpt;
struct Cellpair fs;
Address s;
Address t;
Char buf[u+8]; /* extra chars: .e-9999\0 */
char *c_addr=(char *)c_addr1;
char *s;
char *t;
char buf[u+8]; /* extra chars: .e-9999\0 */
if (isnan(r)) {
sign = 0;
decpt = 0;
......@@ -626,10 +627,9 @@ struct Cellpair represent(Float r, Address c_addr, UCell u, Cell *np)
}
repstr("infinity",c_addr,u);
} else {
int ret;
ok = -1;
r = fabs(r);
if(snprintf(buf,u+8,"%.*e",r,u-1)<0)
if(snprintf(buf,u+8,"%.*e",(int)u-1,r)<0)
fprintf(stderr,"represent error: %s\n", strerror(errno));
for (s=buf, t=c_addr;; s++) {
char c = *s;
......@@ -638,7 +638,7 @@ struct Cellpair represent(Float r, Address c_addr, UCell u, Cell *np)
else if (c != '.')
break;
}
/* fprintf(stderr,"r=%.*e, t=%p, c_addr=%p, u=%ld\n",r,u-1,t,c_addr,u);*/
/* fprintf(stderr,"r=%.*e, t=%p, c_addr=%p, u=%ld\n",(int)u-1,r,t,c_addr,u);*/
assert(t == c_addr+u);
assert(*s == 'e');
s++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment