Top
Back: number expressions
Forward: number related functions
FastBack: module
FastForward: poly
Up: number
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: 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: number expressions Forward: number related functions FastBack: module FastForward: poly Up: number Top: Singular 2-0-4 Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 2-0-4, May 2003, generated by texi2html.