2 issq - whether a value is a square
13 Determine if x is a square. If there exists integers a, b such that:
15 x == a^2 / b^2 (b != 0)
17 return 1, otherwise return 0.
19 Note that issq() works on rational values, so:
23 If you want to test for prefect square integers, you need to exclude
24 non-integer values before you test:
26 isint(curds) && issq(curds)
29 ; print issq(25), issq(3), issq(0)
32 ; print issq(4/25), issq(-4/25), issq(pi())
39 BOOL qissquare(NUMBER *x)
40 BOOL zissquare(ZVALUE x)
43 isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile,
44 ishash, isident, isint, islist, ismat, ismult, isnull, isnum, isobj,
45 isobjtype, isodd, isprime, isrand, israndom, isreal, isrel,
46 issimple, isstr, istype
48 ## Copyright (C) 1999 Landon Curt Noll
50 ## Calc is open software; you can redistribute it and/or modify it under
51 ## the terms of the version 2.1 of the GNU Lesser General Public License
52 ## as published by the Free Software Foundation.
54 ## Calc is distributed in the hope that it will be useful, but WITHOUT
55 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
56 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
57 ## Public License for more details.
59 ## A copy of version 2.1 of the GNU Lesser General Public License is
60 ## distributed with calc under the filename COPYING-LGPL. You should have
61 ## received a copy with calc; if not, write to Free Software Foundation, Inc.
62 ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
64 ## @(#) $Revision: 30.1 $
65 ## @(#) $Id: issq,v 30.1 2007/03/16 11:10:42 chongo Exp $
66 ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/issq,v $
68 ## Under source code control: 1994/10/21 02:21:31
69 ## File existed as early as: 1994
71 ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
72 ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/