/
PCONST.c
41 lines (34 loc) · 819 Bytes
/
PCONST.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*======================================================================
b <- PCONST(r,A)
Polynomial constant.
Inputs
A : a polynomial in r variables.
r : a BETA-digit,r >= 1.
Outputs
b : integer, b = 1 if A is a constant polynomial, otherwise b = 0.
======================================================================*/
#include "saclib.h"
Word PCONST(r,A)
Word r,A;
{
Word Ap,b,i;
/* hide algorithm */
Step1: /* A = 0. */
b = 1;
if (A == 0)
goto Return;
Step2: /* A /= 0. */
Ap = A;
for (i = 1; i <= r; i++)
{
if (PDEG(Ap) != 0)
{
b = 0;
goto Return;
}
else
Ap = PLDCF(Ap);
}
Return: /* Prepare for return. */
return(b);
}