Boolean Operators

print

Boolean Operators



Conditional branching may very much depend on the outcome of a boolean query. in this section we describe all such types of queries as well as the different ways to process boolean values.

Infix Operators


Testing equality: <expr1> == <expr2>





Description: This operator tests whether two expressions evaluate to the same value. The result of this operator is either true or false.




Testing inequality: <expr1> != <expr2>




Description: This operator tests whether two expressions do not evaluate to the same value. The result of this operator is either true or false. It is the logical negation of <expr1> == <expr2>.




Greater than: <expr1> > <expr2>




Description: This operator tests whether the expression <expr1> is greater than the expression <expr2>. It returns a <bool> value. The comparison is available only for two situations: If both expressions are real numbers, then the order of size is the usual ordering of real numbers. If both expressions are strings, then the order is the lexicographic (dictionary) order. In all other cases (if the values are not comparable) the value ____ is returned.





Less than: <expr1> < <expr2>




Description: This operator is similar to > but tests for less than.




Greater than or equal: <expr1> >= <expr2>




Description: This operator is similar to > but tests for greater than or equal to.




Less than or equal: <expr1> <= <expr2>




Description: This operator is similar to > but tests for less than or equal to.




Fuzzy comparisons: ~=, ~!=, ~<, ~>, ~>=, ~<=


Description: CindyScript provides a fuzzy variant for each comparison operator. This version tests whether the condition is satisfied up to an epsilon bound. Thus the test a~=0 tests whether is the variable a lies between +epsilon and -epsilon. The small value epsilon is set to 0.0000000001. This operator is sometimes very useful to circumvent inaccuracies which are unavoidable in purely numerical calculations.


The exact semantics of the exact and the fuzzy operators can be read off from the following diagram. Here for each operator the picture shows for which region of b (marked in red) the operator evaluates to true.





Logical and: <bool1> & <bool2>






Description: Logical and of two Boolean values defined by the following truth table:


ABA & B
falsefalsefalse
falsetruefalse
truefalsefalse
truetruetrue


If one of the two arguments is not a Boolean expression, the operator returns ___.



Logical or: <bool1> % <bool2>





Description: Logical or of two Boolean values defined by the following truth table:


ABA % B
falsefalsefalse
falsetruetrue
truefalsetrue
truetruetrue


If one of the two arguments is not a Boolean expression, the operator returns ___.



Logical not: !<bool>






Description: Logical not of one Boolean value defined by the following truth table:


A!A
falsetrue
truefalse


If the argument is not a Boolean expression, the operator returns ____.




Functional Operators



Logical and: and(<bool1>,<bool2>)




Description: and(x,y) is equivalent to x & y.





Logical or: or(<bool1>,<bool2>)




Description: or(x,y) is equivalent to x % y.





Logical not: not(<bool>)




Description: not(x) is equivalent to !x.





Logical exclusive or: xor(<bool1>,<bool2>)




Description: Logical exclusive or of two Boolean values defined by the following truth table:


ABxor(A,B)
falsefalsefalse
falsetruetrue
truefalsetrue
truetruefalse


If one of the two arguments is not a Boolean expression, the operator returns ___.




Type Predicates


The following predicates test whether the expression <expr> belongs to a certain class of objects. The predicates are important in defining functions whose behavior depends on the type of input expressions. Furthermore, these arguments are very useful for debugging, since they can be used to test assertions on the typing of the values in a program.




Is an integer: isinteger(<expr>)




Description: This operator tests whether the expression <expr> is an integer.





Is a real number: isreal(<expr>)




Description: This operator tests whether the expression <expr> is a real number. Note that integers are also real numbers.






Is a complex number: iscomplex(<expr>)




Description: This operator tests whether the expression <expr> is a complex number. Note that real numbers are also complex numbers.






Is even: iseven(<expr>)





Description: This operator tests whether the expression <expr> is an even integer.




Is odd: isodd(<expr>)





Description: This operator tests whether the expression <expr> is an odd integer.




Is a list: islist(<expr>)




Description: This operator tests whether the expression <expr> is a list.






Is a matrix: ismatrix(<expr>)




Description: This operator tests whether the expression <expr> has the shape of a matrix. This means that the entries of the list are themselves lists, all of equal length. If there are n entries each of length m the expression represents an n × m matrix.




Is a number vector: isnumbervector(<expr>)




Description: This operator tests whether the expression <expr> is a list all of whose entries are numbers (integer, real, or complex).




Is a number matrix: isnumbermatrix(<expr>)




Description: This operator tests whether the expression <expr> is a matrix all of whose entries are numbers (integer, real, or complex).




Is a string: isstring(<expr>)




Description: This operator tests whether the expression <expr> is a string.




Is a geometric element: isgeometric(<expr>)




Description: This operator tests whether the expression <expr> represents a geometric element.




Is selected: isselected(<expr>)




Description: This operator tests whether the expression <expr> represents a geometric element and is selected. For a geometric element you can also use the .selected property to check this.




Is a point: ispoint(<expr>)




Description: This operator tests whether the expression <expr> represents a geometric point.




Is a line: isline(<expr>)




Description: This operator tests whether the expression <expr> represents a geometric line.




Is a circle: iscircle(<expr>)




Description: This operator tests whether the expression <expr> represents a geometric circle.




Is a conic: isconic(<expr>)




Description: This operator tests whether the expression <expr> represents a geometric conic.




Is a mass: ismass(<expr>)




Description: This operator tests whether the expression <expr> represents a CindyLab mass.





Is a sun: issun(<expr>)




Description: This operator tests whether the expression <expr> represents a CindyLab sun.




Is a spring: isspring(<expr>)




Description: This operator tests whether the expression <expr> represents a CindyLab spring.




Is undefined: isundefined(<expr>)




Description: This operator tests whether the expression <expr> returns an undefined element (___).


Contributors to this page: von Gagern , Lembach and Kortenkamp .
Page last modified on Monday 09 of February, 2015 [19:37:16 UTC] by von Gagern.

The content on this page is licensed under the terms of the License.


Menu
free viagra samplehentai girlsmature pussymilfseeker cialis samplescam clip movie nude webcammother incest order viagra online cialis ukanime rapeparis hilton phone numbers viagra alternatives cialis forum cialis free samplehot girls in pantiesmonster of cocks discount cialis cilias free viagra samplesfree chat rooms cilia structurefree cartoon sex comics buy cialis order viagrafree adult videosplump girl gallerypantyhose gallerycum on her face cheapest cialisbisexual moviestampa bukakehuge black cock thumbnails buy cialis onlineporn star cialis drugwomen having sex cheap generic viagra alternative to viagra natural viagra cheap viagraoral sexteen webcam strip videosnude spanish girlserotic sex cams movies viagra side effectscartoon adultdisney sex animenude blonde hairygang bang swinger cialis viagrabisexual free moviesgay twinkswebcam chat live xxxyoung teens order cialislatina girls thongscum loversjapanese girl viagra cheapyoung japanese girlsmr chews asian beavergangbang squadshoshone indiansmature wiveslive webcam chat girlsfree ebony viagra on lineasian ladyboysteen boys viagra pillsself bondage techniques cailisincest familyfree ebony cheap cialisgay amateur cialis genericbusty asian viagra onlinemature breasts viagra for women free viagrabig boobies cialis generic viagragloryhole gaylatinas in thongs female viagraindian tits viagra 6 free samplesamateur upskirt viagra alternativefree xxx video cialis online discountgalleries of teen girls cialis dosage cheap generic cialisparis hilton pornopussy cat dollsbrutal sexgay peopleblack milfsno tits discount viagrablonde hairy pussyshemale animefree hardcore moviesmom strips for sonfat titscelebrity legsdouble anal levitra vs cialis cialis tadalafil cialis cheapgay bdsmcelebrities exposed viagra generic alternatives to viagra viagra canadabestialitypink porn stars viagra jokesclips of teen sexchicks suck horse cock online viagrasex with horsespainful analglory holes floridafree american bukkake cialis online buy viagrabig cock cum free cialisteen gay porn cialis side effects herbal viagra best price viagra purchase cialis cialis soft tabs cialis vs viagrafree fat girl webcamfree porn movie clipsoral penis suckingebony hardcore viagra pricepantyhose crossed legs cialis and levitralesbiennesblonde boobs buy viagra online