Commit 859c9835 authored by kollo's avatar kollo

fixed little bug in STR$() for complex numbers with negative imaginary part

Also affected PRINT in bytecode programs.
parent 9f9e81e7
......@@ -396,8 +396,13 @@ static STRING f_strs(PARAMETER *plist,int e) { /* STR$(a[,b[,c[,d]]])
break;
case PL_COMPLEX: {
char *formatter2=malloc(48);
sprintf(formatter2,"(%s+%si)",formatter,formatter);
sprintf(ergebnis.pointer,formatter2,plist->real,plist->imag);
if(plist->imag>=0) {
sprintf(formatter2,"(%s+%si)",formatter,formatter);
sprintf(ergebnis.pointer,formatter2,plist->real,plist->imag);
} else {
sprintf(formatter2,"(%s%si)",formatter,formatter);
sprintf(ergebnis.pointer,formatter2,plist->real,plist->imag);
}
free(formatter2);
}
break;
......
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