2 bit - whether a given binary bit is set in a value
14 Determine if the binary bit y is set in x. If:
20 return 1, otherwise return 0.
23 ; print bit(9,0), bit(9,1), bit(9,2), bit(9,3)
26 ; print bit(9,4), bit(0,0), bit(9,-1)
29 ; print bit(1.25, -2), bit(1.25, -1), bit(1.25, 0)
33 ; print bit(p, 1), bit(p, -2), bit(p, -3)
40 BOOL qbit(NUMBER *x, long y)
43 highbit, lowbit, digit
45 ## Copyright (C) 1999 Landon Curt Noll
47 ## Calc is open software; you can redistribute it and/or modify it under
48 ## the terms of the version 2.1 of the GNU Lesser General Public License
49 ## as published by the Free Software Foundation.
51 ## Calc is distributed in the hope that it will be useful, but WITHOUT
52 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
53 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
54 ## Public License for more details.
56 ## A copy of version 2.1 of the GNU Lesser General Public License is
57 ## distributed with calc under the filename COPYING-LGPL. You should have
58 ## received a copy with calc; if not, write to Free Software Foundation, Inc.
59 ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
61 ## @(#) $Revision: 30.1 $
62 ## @(#) $Id: bit,v 30.1 2007/03/16 11:10:42 chongo Exp $
63 ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/bit,v $
65 ## Under source code control: 1994/10/21 02:21:30
66 ## File existed as early as: 1994
68 ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
69 ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/