Numbers

  Though originally Lisp has been created only for work with symbols and lists, language both by computing efficiency and on the properties quite suits and numerical calculations.

Lisp is able to work with numbers

  The call of function of subtraction without arguments returns number with the changed sign, and function abs - absolute size of number:

>(3 -)
-3
>(-3 abs)
3

  For comparison of numbers following operations are used:

(x = &rest xi) ; numbers are equal
(x <> &rest xi) ; numbers are not equal x
(x < &rest xi) ; numbers increase
(x > &rest xi) ; numbers decrease
(x <= &rest xi) ; increase or are equal (do not decrease)
(x >= &rest xi) ; decrease or are equal (do not increase)

  Operations of comparison suppose any number of arguments:

>(1 < 2 3 4 5 6)
1

  Arithmetic operations are:

(x + &rest xi) ; the sum
(x - &rest xi) ; subtraction
(x * &rest xi) ; multiplication
(x / &rest xi) ; division
(x min &rest xi) ; the least xi
(x max &rest xi) ; the greatest xi

  There is a wide range of the certain transcendental functions, such as exponent, the logarithm and trigonometrical functions:

(x exp) ; e in a power x
(x ^ y) ; x in a power y
(x log y) ; logarithm x on the basis y
(x ln) ; the natural logarithm x on the basis e
(x sqrt) ; square root

  Arguments of following trigonometrical functions are set in radians:

(x sin) and (x arcsin)
(x cos) and (x arccos)
(x tg) and (x arctg)

  The number π is value of a global variable pi. There are hyperbolic and return it functions:

(x sh) and (x arsh)
(x ch) and (x arch)
(x th) and (x arth)

  The generator of random numbers is started in the form of:

  (x random)

  It generates strictly smaller on absolute size, than x a random number.

  Considered before function is applicable to all numbers. Except for that there are specific functions which make sense only for integers.

Integers

  All numbers can be represented with unlimited accuracy. Integers also can be very much greater. At their using accuracy is not lost.
  Here some functions and the predicates certain and used only for integers:

(n evenp) ; checks, whether even number
(n oddp) ; checks, whether not even number
(n gcd &rest ni) ; the greatest general divider
(n lcm &rest ni) ; the least common multiple

Fractional numbers

  Language contains an opportunity absent in traditional programming languages to use fractional numbers without their transformation to numbers from a floating comma, that usually only reduces accuracy of their representation. Fractional numbers are represented by a sign and positive numbers between which there is a fractional feature /:

  1/3
  2/6
; =1/3
  4/1/3
; =4+1/3
  -4/1/3
; =-(4+1/3)

  If as a result of calculations turns out the reduced number, automatically there is a reduction of number up to its initial form.

Representation of numbers with an exponent sign

  For short record very greater(small) numbers it is possible to use record with exponent. The exponent part displays exponent in terms of a degree of ten:

  2.1e3 ; =2100
  -2.1e-3
; =-0.0021

  Record with exponent does not reduce accuracy of number, and is necessary only for brevity to record.

System of calculation

  Also for convenience there is an opportunity to represent number in sixteen system of calculation.

  0xff ; =255
  -0xf.f
; =-(15+15/16)
  0xf.fP2
; =0xff0=4080

  The degree is set by means of other letter as the letter E=14 is borrowed.