Skip to content

Commit

Permalink
Fix 64Bit Cyclotomic Size limit
Browse files Browse the repository at this point in the history
Add test case for 2^32

Adjust test for 32bit systems
  • Loading branch information
Dominik Bernhardt committed Apr 2, 2019
1 parent 0ef46dc commit 35d12ee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/ref/cyclotom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ This can be raised (although not lowered) using
<Ref Func="SetCyclotomicsLimit"/> and
accessed using <Ref Func="GetCyclotomicsLimit"/>.
The maximum value of the limit is <M>2^{28}-1</M> on <M>32</M> bit systems,
and <M>2^{32}</M> on <M>64</M> bit systems.
and <M>2^{32}-1</M> on <M>64</M> bit systems.
So the maximal cyclotomic field implemented in &GAP; is not really
the field <M>&QQ;^{ab}</M>.
<P/>
Expand Down
2 changes: 1 addition & 1 deletion src/cyclotom.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ static Obj FuncSetCyclotomicsLimit(Obj self, Obj newlimit)
CyclotomicsLimit, 0);
}
#ifdef SYS_IS_64_BIT
if (ulimit > (1L << 32)) {
if (ulimit >= (1L << 32)) {
ErrorMayQuit("Cyclotomic field size limit must be less than 2^32", 0,
0);
}
Expand Down
4 changes: 4 additions & 0 deletions tst/testinstall/cyclotom.tst
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ he integer 0)
gap> SetCyclotomicsLimit(100);
Error, SetCyclotomicsLimit: <newlimit> must not be less than old limit of 1000\
000
#@if 8*GAPInfo.BytesPerVariable = 64
gap> SetCyclotomicsLimit(2^32);
Error, Cyclotomic field size limit must be less than 2^32
#@fi
gap> SetCyclotomicsLimit(1000000);

#
Expand Down

0 comments on commit 35d12ee

Please sign in to comment.