GNU Info

Info Node: (librep.info)Arithmetic Functions

(librep.info)Arithmetic Functions


Next: Integer Functions Up: Numbers
Enter node , (file) or (file)node

Arithmetic Functions
--------------------

   There are a number of functions which perform arithmetic operations
on numbers, they take a varying number of values as their arguments
returning a new number as their result. When given only exact
arguments, an exact result will be returned.

 - Function: + number1 #!rest numbers
     This functions adds its arguments then returns their sum.

 - Function: - number1 #!rest numbers
     If this function is just given one argument (NUMBER1) that number
     is negated and returned. Otherwise each of NUMBERS is subtracted
     from a running total starting with the value of NUMBER1.

          (- 20)
              => -20
          
          (- 20 10 5)
              => 5

 - Function: * number1 #!rest numbers
     This function multiplies its arguments then returns the result.

 - Function: / number1 #!rest numbers
     This function performs division, a running-total (initialised from
     NUMBER1 is successively divided by each of NUMBERS then the result
     is returned.

          (/ 100 2)
              => 50
          
          (/ 200 2 5)
              => 20
          
          (/ 3 2)
              => 3/2
          
          (/ 3.0 2)
              => 1.5

 - Function: 1+ number
     This function returns the result of adding one to NUMBER.

          (1+ 42)
              => 43

 - Function: 1- number
     Returns NUMBER minus one.


automatically generated by info2www version 1.2.2.9