Top
Back: 4.11.1 number declarations
Forward: 4.11.3 number operations
FastBack: 4. Data types
FastForward: 5. Functions and system variables
Up: 4.11 number
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

4.11.2 number expressions

A number expression is:

  1. a rational number (there are NO spaces allowed inside a rational number, see int expressions)
  2. a floating point number (if the coefficient field is real):
    <digits>.<digits>e<sign><digits>
  3. an identifier of type number
  4. a function returning number
  5. an int expression (see Type conversion and casting)
  6. number expressions combined by the arithmetic operations +, -, *, /, ^, or **.
  7. a type cast to number

Example:

 
  // the following expressions are in any ring int expressions
  2 / 3;
→ 0
  4/ 8;
→ 0
  2 /2;   // the notation of / for div might change in the future
→ 1
  ring r0=0,x,dp;
  2/3, 4/8, 2/2 ; // are numbers
→ 2/3 1/2 1

  poly f = 2x2 +1;
  leadcoef(f);
→ 2
  typeof(_);
→ number
  ring rr =real,x,dp;
  1.7e-2; 1.7e+2; // are valid (but  1.7e2 not), if the field is `real`
→ 1.700e-02
→ 1.700e+02
  ring rp = (31,t),x,dp;
  2/3, 4/8, 2/2 ; // are numbers
→ 11 -15 1
  poly g = (3t2 +1)*x2 +1;
  leadcoef(g);
→ (3t2+1)
  typeof(_);
→ number
  par(1);
→ (t)
  typeof(_);
→ number

See Type conversion and casting; ring.


Top Back: 4.11.1 number declarations Forward: 4.11.3 number operations FastBack: 4. Data types FastForward: 5. Functions and system variables Up: 4.11 number Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.