Skip to content

Commit

Permalink
Made flag for negative powers in SymbolNormalize
Browse files Browse the repository at this point in the history
  • Loading branch information
vermaseren committed Jun 30, 2015
1 parent b4f3dd2 commit 90761d6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
18 changes: 10 additions & 8 deletions sources/normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -5101,15 +5101,17 @@ Nexti:;
/*
Veto negative powers
*/
b = buffer; bb = b + b[1]; b += 3;
while ( b < bb ) {
if ( *b < 0 ) {
MLOCK(ErrorMessageLock);
MesPrint("Negative power in SymbolNormalize");
MUNLOCK(ErrorMessageLock);
return(-1);
if ( AT.LeaveNegative == 0 ) {

This comment has been minimized.

Copy link
@tueda

tueda Jun 30, 2015

Collaborator

A compilation error for TFORM due to the fact that B is not accessible in SymbolNormalize(). Maybe do we put BHEAD in its arguments?

b = buffer; bb = b + b[1]; b += 3;
while ( b < bb ) {
if ( *b < 0 ) {
MLOCK(ErrorMessageLock);
MesPrint("Negative power in SymbolNormalize");
MUNLOCK(ErrorMessageLock);
return(-1);
}
b += 2;
}
b += 2;
}
/*
Now we use the fact that the new term will not be longer than the old one
Expand Down
6 changes: 4 additions & 2 deletions sources/ratio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ WORD *MultiplyWithTerm(PHEAD WORD *in, WORD *term, WORD par)
}

/*
#] MultiplyWithTerm :
#] MultiplyWithTerm :
#[ TakeContent :
*/
/**
Expand Down Expand Up @@ -2982,7 +2982,9 @@ NormArg:;
/*
We can use MultiplyWithTerm.
*/
AT.LeaveNegative = 1;
numerator = MultiplyWithTerm(BHEAD arg1+ARGHEAD,rmininv,0);
AT.LeaveNegative = 0;
r[-1] = rcopy;
r = numerator; while ( *r ) r += *r;
AT.WorkPointer = r+1;
Expand Down Expand Up @@ -3106,7 +3108,7 @@ NormArg:;
}

/*
#] ExpandRat :
#] ExpandRat :
#[ InvPoly :
The input polynomial is represented as a sequence of terms in ascending
Expand Down
1 change: 1 addition & 0 deletions sources/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,7 @@ WORD IniVars()
AT.inprimelist = -1;
AT.sizeprimelist = 0;
AT.primelist = 0;
AT.LeaveNegative = 0;
AT.TrimPower = 0;
AN.SplitScratch = 0;
AN.SplitScratchSize = AN.InScratch = 0;
Expand Down
2 changes: 1 addition & 1 deletion sources/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,7 @@ struct T_const {
int ListSymbolsSize;
int NumListSymbols;
int numpoly;
int ListPolySize;
int LeaveNegative;
int TrimPower; /* Indicates trimming in polyratfun expansion */
WORD small_power_maxx; /* size of the cache for small powers */
WORD small_power_maxn; /* size of the cache for small powers */
Expand Down

0 comments on commit 90761d6

Please sign in to comment.