Skip to content

Commit 6401489

Browse files
committed
update fps_print
1 parent 8b6f5b8 commit 6401489

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lib/fps.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @param n precision
1313
* @param name name of s
1414
*/
15-
void fps_print(const fps p, prec n, char *name)
15+
void fps_print(const fps s, prec n, char *name)
1616
{
1717
int i;
1818
integer v;
@@ -24,18 +24,18 @@ void fps_print(const fps p, prec n, char *name)
2424
}
2525
for (i = 0; i < n; i++)
2626
{
27-
if (p[i] == 0)
27+
if (s[i] == 0)
2828
{
2929
continue;
3030
}
31-
if (p[i] < 0)
31+
if (s[i] < 0)
3232
{
33-
v = -p[i];
33+
v = -s[i];
3434
printf(" -");
3535
}
3636
else
3737
{
38-
v = p[i];
38+
v = s[i];
3939
if (i != 0)
4040
{
4141
printf(" +");
@@ -54,7 +54,14 @@ void fps_print(const fps p, prec n, char *name)
5454
printf(" z");
5555
}
5656
}
57-
printf(" + O(z^%d)\n", n);
57+
if (n == 1)
58+
{
59+
printf(" + O(z)\n");
60+
}
61+
else
62+
{
63+
printf(" + O(z^%d)\n", n);
64+
}
5865
}
5966

6067
/**

0 commit comments

Comments
 (0)