Trace may affect correct output of 1::EXPR INT
. This page should be read in conjunction with IssueTracker #283.
To suppress the infinite loop being displayed till overflow, add )math
to the package traced (does not always work). I think the coercion 2/3::FRAC INT
is where the main bug lies, but since it is affected by )trace
, it may not be easy to find.
We first establish that without )trace
, the following works as intended.
fricas
(1) -> 2/3::FRAC INT
Type: Fraction(Integer)
fricas
1::EXPR INT
Type: Expression(Integer)
What led me to suspect that FRAC
is involved in the )trace
bug is the following trace obtained in a Windows session (but unfortunately, I no longer know the exact set up to reproduce this):
(7) -> 1::EXPR INT
1<enter SparseMultivariatePolynomial.zero?,17 :
arg1= 1
1>exit SparseMultivariatePolynomial.zero?,17 :
false
1<enter Fraction.*,60 : 1\((0 . 1) 0 . 1)
1<enter SparseMultivariatePolynomial.coerce,77 :
arg1= 1
1>exit SparseMultivariatePolynomial.coerce,77 :
1
1<enter SparseMultivariatePolynomial.=,97 :
arg1= 1
arg2= 1
1>exit SparseMultivariatePolynomial.=,97 :
true
1<enter SparseMultivariatePolynomial.*,65 :
arg1= 1
arg2= 1
1<enter SparseMultivariatePolynomial.*,90 :
arg1= 1
arg2= 1
1>exit SparseMultivariatePolynomial.*,90 :
1
1>exit SparseMultivariatePolynomial.*,65 :
1
1<enter SparseMultivariatePolynomial.zero?,17 :
arg1= 1
1>exit SparseMultivariatePolynomial.zero?,17 :
false
1<enter SparseMultivariatePolynomial.=,97 :
arg1= 1
arg2= 1
1>exit SparseMultivariatePolynomial.=,97 :
true
1>exit Fraction.*,60 : ((0 . 1) 0 . 1)
1<enter Fraction.denom,73 : ((0 . 1) 0 . 1)
2<enter Fraction.denom,73 : ((0 . 1) 0 . 1)
3<enter Fraction.denom,73 : ((0 . 1) 0 . 1)
...
The following, surprisingly also works (trying to recreate the above trace, but failed).
fricas
)trace FRAC
Parameterized constructors traced:
FRAC
fricas
)trace SMP )math
Parameterized constructors traced:
FRAC, SMP
1::EXPR INT
Type: Expression(Integer)
Here are trace examples that produced Bind Stack Overflow.
fricas
)trace INT
Parameterized constructors traced:
FRAC, SMP, INT
fricas
)trace FRAC
Parameterized constructors traced:
SMP, INT, FRAC
fricas
)trace EXPR INT )math
Packages traced:
Integer, Expression(Integer)
Parameterized constructors traced:
SMP, INT, FRAC
fricas
)trace KERNEL EXPR INT
Packages traced:
Integer, Expression(Integer), Kernel(Expression(Integer))
Parameterized constructors traced:
SMP, INT, FRAC
fricas
)trace SMP(INT, KERNEL EXPR INT)
Packages traced:
Integer, Expression(Integer), Kernel(Expression(Integer)),
SparseMultivariatePolynomial(Integer,Kernel(
Expression(Integer)))
Parameterized constructors traced:
SMP, INT, FRAC
fricas
)trace OutputForm
Packages traced:
Integer, Expression(Integer), Kernel(Expression(Integer)),
SparseMultivariatePolynomial(Integer,Kernel(
Expression(Integer)))
Parameterized constructors traced:
SMP, INT, FRAC, OUTFORM
1::EXPR INT
1<enter Expression.coerce,61 :
arg1 = 1
1>exit Expression.coerce,61 :
1
1<enter Expression.denom,101 :
arg1 = 1
1>exit Expression.denom,101 :
1
1<enter Expression.numer,99 :
arg1 = 1
1>exit Expression.numer,99 :
1
Type: Expression(Integer)
fricas
2/3::FRAC INT
1<enter Fraction./,127 : (2 . 1)\(3 . 1)
1<enter Fraction.zero?,13 : (3 . 1)
1<enter Integer.zero?,18 : 3
1>exit Integer.zero?,18 : NIL
1>exit Fraction.zero?,13 : NIL
1<enter Fraction.recip,54 : (3 . 1)
1<enter Integer.zero?,18 : 3
1>exit Integer.zero?,18 : NIL
1<enter Integer.zero?,18 : 1
1>exit Integer.zero?,18 : NIL
1<enter Integer.=,58 : 3\1
1>exit Integer.=,58 : NIL
1<enter Integer.unitNormal,90 : 3
1>exit Integer.unitNormal,90 : #(1 3 1)
1<enter Integer.zero?,18 : 3
1>exit Integer.zero?,18 : NIL
1<enter Integer.*,67 : 1\1
1<enter Integer.*,66 : 1\1
1>exit Integer.*,66 : 1
1>exit Integer.*,67 : 1
1>exit Fraction.recip,54 : (0 1 . 3)
1<enter Fraction.*,61 : (2 . 1)\(1 . 3)
1<enter Fraction.zero?,13 : (2 . 1)
1<enter Integer.zero?,18 : 2
1>exit Integer.zero?,18 : NIL
1>exit Fraction.zero?,13 : NIL
1<enter Fraction.zero?,13 : (1 . 3)
1<enter Integer.zero?,18 : 1
1>exit Integer.zero?,18 : NIL
1>exit Fraction.zero?,13 : NIL
1<enter Fraction.=,21 : (2 . 1)\(1 . 1)
1<enter Integer.=,58 : 2\1
1>exit Integer.=,58 : NIL
1>exit Fraction.=,21 : NIL
1<enter Fraction.=,21 : (1 . 3)\(1 . 1)
1<enter Integer.=,58 : 1\1
1>exit Integer.=,58 : T
1<enter Integer.=,58 : 3\1
1>exit Integer.=,58 : NIL
1>exit Fraction.=,21 : NIL
1<enter Integer.=,58 : 3\1
1>exit Integer.=,58 : NIL
1<enter Integer.gcd,88 : 2\3
1>exit Integer.gcd,88 : 1
1<enter Integer.one?,19 : 1
1>exit Integer.one?,19 : T
1<enter Integer.=,58 : 1\1
1>exit Integer.=,58 : T
1<enter Integer.*,67 : 2\1
1<enter Integer.*,66 : 2\1
1>exit Integer.*,66 : 2
1>exit Integer.*,67 : 2
1<enter Integer.*,67 : 3\1
1<enter Integer.*,66 : 3\1
1>exit Integer.*,66 : 3
1>exit Integer.*,67 : 3
1<enter Integer.zero?,18 : 2
1>exit Integer.zero?,18 : NIL
1<enter Integer.=,58 : 3\1
1>exit Integer.=,58 : NIL
1<enter Integer.unitNormal,90 : 3
1>exit Integer.unitNormal,90 : #(1 3 1)
1<enter Integer.zero?,18 : 3
1>exit Integer.zero?,18 : NIL
1<enter Integer.*,67 : 2\1
1<enter Integer.*,66 : 2\1
1>exit Integer.*,66 : 2
1>exit Integer.*,67 : 2
1>exit Fraction.*,61 : (2 . 3)
1>exit Fraction./,127 : (2 . 3)
Type: Fraction(Integer)
For a preliminary analysis, see SandBox Trace Analysed.