XLISP sqrt

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# sqrt

Type: | - | function (subr)
Source: | - | xlmath.c

## Syntax

(sqrt expr)
  expr - floating point number or expression
  returns - the square root of the number

## Description

The 'sqrt' function calculates the square root of 'expr' and returns this result.

## Examples

    (sqrt 1.0)    ; returns 1
    (sqrt 2.0)    ; returns 1.41421
    (sqrt 3.0)    ; returns 1.73205
    (sqrt 4.0)    ; returns 2
    (sqrt 5.0)    ; returns 2.23607
    (sqrt -1.0)   ; error: square root of a negative number
    (sqrt 2)      ; error: bad integer operation

Common Lisp: Common Lisp allows for integer numbers, which XLISP does not support for 'sqrt'.

See the sqrt function in the XLISP 2.0 manual.

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference