Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PolyRatFun Division by zero during normalization #336

@jodavies

Description

@jodavies

Related: #178 , possibly #270.

There are still division by zero problems when using PolyRatFun, in both form and tform (#270 seems to be a tform-only problem).

I don't have a minimal example currently, terms which cause the problem (found using `print "%t";) do not cause problems when run alone in a simple script.

I have bisected the problem to a0b635c.

The polynomials here are not large, a crash is obtained for example when the product

prf(1,1 + t)*prf( - 40 - 40*t - 136*t^2 - 40*t^3,9*t^2 + 18*t^3 + 9*t^4)

is produced, with output

prf( - 40 - 40*t - 136*t^2 - 40*t^3,0)

which causes Division by zero during normalization at the following sort.

There are no valgrind errors.

The DEBUG spam for this term is as follows:

*** [57.578]  CALL: gcd(0,9*a^3)                                   
*** [57.5781]  CALL : poly_ratfun_normalize                        
*** [57.5781]  CALL : poly_ratfun_read                             
*** [57.5781]  CALL: gcd(1,a+1)                                    
*** [57.5781]  CALL: integer_content(a+1)                          
*** [57.5781]  RES : integer_content(a+1) = 1                      
*** [57.5781]  CALL: integer_content(1)                            
*** [57.5781]  RES : integer_content(1) = 1                        
*** [57.5781]  CALL: integer_gcd(1,1)                              
*** [57.5781]  RES : integer_gcd(1,1) = 1                          
*** [57.5781]  CALL: gcd(1,a+1)                                    
*** [57.5781]  CALL: integer_content(a+1)                          
*** [57.5781]  RES : integer_content(a+1) = 1                      
*** [57.5781]  CALL: integer_content(1)                            
*** [57.5781]  RES : integer_content(1) = 1                        
*** [57.5781]  CALL: integer_gcd(1,1)                              
*** [57.5781]  RES : integer_gcd(1,1) = 1                          
*** [57.5781]  CALL: gcd(1,1)                                      
*** [57.5781]  CALL : poly_ratfun_read                             
*** [57.5781]  CALL: gcd(1,9*a^2+18*a^3+9*a^4)                     
*** [57.5781]  CALL: integer_content(9*a^2+18*a^3+9*a^4)           
*** [57.5781]  RES : integer_content(9*a^2+18*a^3+9*a^4) = 9       
*** [57.5781]  CALL: integer_content(1)                            
*** [57.5781]  RES : integer_content(1) = 1                        
*** [57.5781]  CALL: integer_gcd(1,9)                              
*** [57.5782]  RES : integer_gcd(1,9) = 1                          
*** [57.5782]  CALL: gcd(-40-40*a-136*a^2-40*a^3,a+1)              
*** [57.5782]  CALL: integer_content(-40-40*a-136*a^2-40*a^3)      
*** [57.5782]  RES : integer_content(-40-40*a-136*a^2-40*a^3) = -8 
*** [57.5782]  CALL: integer_content(a+1)                          
*** [57.5782]  RES : integer_content(a+1) = 1                      
*** [57.5782]  CALL: integer_gcd(-8,1)                             
*** [57.5782]  RES : integer_gcd(-8,1) = 1                         
*** [57.5782]  CALL: gcd_heuristic(5+5*a+17*a^2+5*a^3,a+1,{0})     
*** [57.5782]  CALL: gcd_heuristic(5,37,{})                        
*** [57.5782]  CALL: integer_content(37)                           
*** [57.5782]  RES : integer_content(37) = 37                      
*** [57.5782]  CALL: integer_gcd(5,37)                             
*** [57.5782]  RES : integer_gcd(5,37) = 1                         
*** [57.5782]  CALL: integer_content(1)                            
*** [57.5782]  RES : integer_content(1) = 1                        
*** [57.5782]  RES : gcd_heuristic(5+5*a+17*a^2+5*a^3,a+1,{0}) = 1 
*** [57.5782]  CALL: integer_content(1)                            
*** [57.5782]  RES : integer_content(1) = 1                        
*** [57.5782]  RES : gcd(-40-40*a-136*a^2-40*a^3,a+1) = 1          

Thanks,
Josh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions