1NAME 2 bit - whether a given binary bit is set in a value 3 4SYNOPSIS 5 bit(x, y) 6 7TYPES 8 x real 9 y int 10 11 return int 12 13DESCRIPTION 14 Determine if the binary bit y is set in x. If: 15 16 x 17 int(---) mod 2 == 1 18 2^y 19 20 return 1, otherwise return 0. 21 22EXAMPLE 23 ; print bit(9,0), bit(9,1), bit(9,2), bit(9,3) 24 1 0 0 1 25 26 ; print bit(9,4), bit(0,0), bit(9,-1) 27 0 0 0 28 29 ; print bit(1.25, -2), bit(1.25, -1), bit(1.25, 0) 30 1 0 1 31 32 ; p = pi() 33 ; print bit(p, 1), bit(p, -2), bit(p, -3) 34 1 0 1 35 36LIMITS 37 -2^31 < y < 2^31 38 39LINK LIBRARY 40 BOOL qbit(NUMBER *x, long y) 41 42SEE ALSO 43 highbit, lowbit, digit 44 45## Copyright (C) 1999 Landon Curt Noll 46## 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. 50## 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. 55## 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. 60## 61## Under source code control: 1994/10/21 02:21:30 62## File existed as early as: 1994 63## 64## chongo <was here> /\oo/\ http://www.isthe.com/chongo/ 65## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 66