Previous Page Next Page Contents

isqrt -- integer square root

Introduction

isqrt(n) computes an integer approximation to the square root of the integer n.

Call(s)

isqrt(n)

Parameters

n - an arithmetical expression representing an integer

Returns

a nonnegative integer, an integral multiple of I, or a symbolic isqrt call.

Overloadable:

n

Related Functions

_power, icontent, ifactor, igcd, ilcm, numlib::ispower, numlib::issqr, sqrt, trunc

Details

Example 1

We compute some integer square roots:

>> isqrt(4), isqrt(5)
                                   2, 2

The approximation error is less than 1:

>> isqrt(99), float(sqrt(99))
                              9, 9.949874371

The integer square root of a negative integer is an integral multiple of I:

>> isqrt(-4), isqrt(-5)
                                 2 I, 2 I

If the argument is not a number, the result is a symbolic isqrt call:

>> delete n: isqrt(n)
                                 isqrt(n)
>> type(%)
                                  "isqrt"

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000