Differences

This shows you the differences between two versions of the page.

 cl:functions:logbitp [2019/07/14 17:00] cl:functions:logbitp [2019/10/19 05:00] (current) Line 1: Line 1: + ====== Function LOGBITP ====== + + ====Syntax==== + * **logbitp** //index integer// → //​generalized-boolean//​ + + ====Arguments and Values==== + * //index// - a non-negative //​[[CL:​Glossary:​integer]]//​. + * //integer// - an //​[[CL:​Glossary:​integer]]//​. + * //​generalized-boolean//​ - a //​[[CL:​Glossary:​generalized boolean]]//​. + + ====Description==== + **logbitp** is used to test the value of a particular bit in //​integer//,​ that is treated as if it were binary. + + The value of **logbitp** is //​[[CL:​Glossary:​true]]//​ if the bit in //integer// whose index is //index// (that is, its weight is ''​2^index''​) is a one-bit; otherwise it is //​[[CL:​Glossary:​false]]//​. + + Negative //​integers//​ are treated as if they were in two'​s-complement notation. + + ====Examples==== ​ + <​blockquote> ​ + (logbitp 1 1) <​r>//​[[CL:​Glossary:​false]]//​ + (logbitp 0 1) <​r>//​[[CL:​Glossary:​true]]//​ + (logbitp 3 10) <​r>//​[[CL:​Glossary:​true]]//​ + (logbitp 1000000 -1) <​r>//​[[CL:​Glossary:​true]]//​ + (logbitp 2 6) <​r>//​[[CL:​Glossary:​true]]//​ + (logbitp 0 6) <​r>//​[[CL:​Glossary:​false]]//​ + ​ + + ====Side Effects==== + None. + + ====Affected By==== + None. + + ====Exceptional Situations==== + Should signal an error of type type-error if //index// is not a non-negative //​[[CL:​Glossary:​integer]]//​. Should signal an error of type type-error if //integer// is not an //​[[CL:​Glossary:​integer]]//​. + + ====See Also==== + None. + + ====Notes==== + <​blockquote> ​ + (logbitp //k// //n//) ≡ ([[CL:​Functions:​ldb-test]] ([[CL:​Functions:​byte]] 1 //k//) //​n//​) ​ + ​ + + \issue{ARGUMENTS-UNDERSPECIFIED:​SPECIFY}