Top
Back: 4.11.2 number expressions
Forward: 4.11.4 number related functions
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.3 number operations

+

addition

-

negation or subtraction

*

multiplication

/

division

^, **

power, exponentiation (by an integer)

<=, >=, ==, <>

comparison

mod

integer modulo (the remainder of the division div), always non-negative

Note: quotient and exponentiation is only recognized as a number expression if it is already a number, see Miscellaneous oddities.
For the behavior of comparison operators in rings with ground field different from real or the rational numbers, see boolean expressions.


Example:

 
  ring r=0,x,dp;
  number n = 1/2 +1/3;
  n;
→ 5/6
  n/2;
→ 5/12
  1/2/3;
→ 1/6
  1/2 * 1/3;
→ 1/6
  n = 2;
  n^-2;
→ 1/4
  // the following oddities appear here
  2/(2+3);
→ 0
  number(2)/(2+3);
→ 2/5
  2^-2; // for int's exponent must be non-negative
→    ? exponent must be non-negative
→    ? error occurred in line 12: `  2^-2; // for int's exponent must be no\
   n-negative`
  number(2)^-2;
→ 1/4
  3/4>=2/5;
→ 1
  2/6==1/3;
→ 1

Top Back: 4.11.2 number expressions Forward: 4.11.4 number related functions 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.