Changeset 7b8e28f in git for libpolys/coeffs/ffields.cc


Ignore:
Timestamp:
Mar 12, 2021, 12:55:50 PM (3 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
0dd7e8bafbd1f4c71feb76c0c887ba2fbbc66ef7
Parents:
24457e03b41762fa464203e9f37e01f02fce2468
Message:
fix: Singular.j power error (#386)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/ffields.cc

    r24457e r7b8e28f  
    858858BOOLEAN nfInitChar(coeffs r,  void * parameter)
    859859{
     860  // the variables:
     861  assume( getCoeffType(r) == n_GF );
     862
     863  GFInfo* p = (GFInfo *)(parameter);
     864  assume (p->GFChar > 0);
     865  assume (p->GFDegree > 0);
     866  if ((IsPrime(p->GFChar)==p->GFChar)&&(p->GFDegree==1)) /* for oscar-system/Singular.jl/issues/177 */
     867  {
     868    return npInitChar(r,(void*)(long)p->GFChar);
     869  }
     870  if(p->GFChar > (2<<15))
     871  {
     872#ifndef SING_NDEBUG
     873    WarnS("illegal characteristic");
     874#endif
     875    return TRUE;
     876  }
     877
     878  const double check= log ((double) (p->GFChar));
     879
     880  #define sixteenlog2 11.09035489
     881  if( (p->GFDegree * check) > sixteenlog2 )
     882  {
     883#ifndef SING_NDEBUG
     884    Warn("Sorry: illegal size: %u ^ %u", p->GFChar, p->GFDegree );
     885#endif
     886    return TRUE;
     887  }
     888
    860889  r->is_field=TRUE;
    861890  r->is_domain=TRUE;
     
    915944#endif
    916945
    917   // the variables:
    918   assume( getCoeffType(r) == n_GF );
    919 
    920   GFInfo* p = (GFInfo *)(parameter);
    921   assume (p->GFChar > 0);
    922   assume (p->GFDegree > 0);
    923946
    924947  const char * name = p->GFPar_name;
     
    948971  r->has_simple_Inverse=TRUE;
    949972
    950   if ((IsPrime(p->GFChar)==p->GFChar)&&(p->GFDegree==1)) /* for oscar-system/Singular.jl/issues/177 */
    951   {
    952     return npInitChar(r,(void*)(long)p->GFChar);
    953   }
    954   if(p->GFChar > (2<<15))
    955   {
    956 #ifndef SING_NDEBUG
    957     WarnS("illegal characteristic");
    958 #endif
    959     return TRUE;
    960   }
    961 
    962   const double check= log ((double) (p->GFChar));
    963 
    964   #define sixteenlog2 11.09035489
    965   if( (p->GFDegree * check) > sixteenlog2 )
    966   {
    967 #ifndef SING_NDEBUG
    968     Warn("Sorry: illegal size: %u ^ %u", p->GFChar, p->GFDegree );
    969 #endif
    970     return TRUE;
    971   }
    972 
    973973  int c = (int)pow ((double)p->GFChar, (double)p->GFDegree);
    974974
Note: See TracChangeset for help on using the changeset viewer.