|
4.3.2 int expressionsAn int expression is:
Note: Variables of type int represent the compiler integers and are, therefore, limited in their range (see Limitations). If this range is too small the expression must be converted to the type number over a ring with characteristic 0. Example: 12345678901; // too large → ? `12345678901` greater than 2147483647(max. integer representation) → ? error occurred in line 1: `12345678901; // too large` typeof(_); → none ring r=0,x,dp; 12345678901; → 12345678901 typeof(_); → number // Note: 11*13*17*100*200*2000*503*1111*222222 // returns a machine integer: 11*13*17*100*200*2000*503*1111*222222; → // ** int overflow(*), result may be wrong → // ** int overflow(*), result may be wrong → // ** int overflow(*), result may be wrong → // ** int overflow(*), result may be wrong → -1875651584 // using the type cast number for a greater allowed range number(11)*13*17*100*200*2000*503*1111*222222; → 12075748128684240000000 ring rp=32003,x,dp; 12345678901; → 9603 typeof(_); → number intmat m[2][2] = 1,2,3,4; m; → 1,2, → 3,4 m[2,2]; → 4 typeof(_); → int det(m); → -2 m[1,1] + m[2,1] == trace(m); → 0 ! 0; → 1 1 and 2; → 1 intvec v = 1,2,3; def d =transpose(v)*v; // scalarproduct gives an 1x1 intvec typeof(d); → intvec int i = d[1]; // access the first (the only) entry in the intvec ring rr=31,(x,y,z),dp; poly f = 1; i = int(f); // cast to int // Integers may be converted to constant polynomials by an assignment, poly g=37; // define the constant polynomial g equal to the image of // the integer 37 in the actual coefficient field, here it equals 6 g; → 6 |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |