Questions tagged [negation]

Negation is the logic operation that inverses a value, also seen as a NOT operation. Functions in specific languages may operate with negation to specific uses. For questions specific to the use of complement patterns in regular expressions, use [regex-negation] instead.

Negation is the logic operation that inverses a value, also seen as a NOT operation. Negation may be implemented by specific languages to provide functions capable of operating with values for specific uses.

Read also the wikipedia article on Negation.

248 questions
0
votes
1 answer

Equality negation to determine Least Significant Bit

Basically, I want to check if the last significant bit is a 0. I already had a condition to test if the bit is set or not (or at least, I believe so) : cells[x + y * cols] & 1 === 1 At some point, I need the negation of this, so I thought : cells[x…
Zabon
  • 241
  • 2
  • 18
0
votes
0 answers

How can i perform binary negation on this number to get an answer

I am learning binary code and I can't get my head around binary negation. I have an example and was hoping someone could walk me through how to answer this question. Perform binary negation on this binary number. -11011 The answer is 11100101 but…
Yakob
  • 159
  • 1
  • 7
0
votes
2 answers

How can we write "not equal" in c?

In part of a code I saw this phrase: !(word[i]==(tmpP->word[i])) is it equal to (word[i] != (tmpP->word[i])) ? What is the difference between these two expressions?
sajjad eshghi
  • 69
  • 1
  • 5
0
votes
1 answer

negation handling in R add the prefix "neg_" to the word before a "not"

I am doing sentiment analysis with german customer reviews and want to implement negation handling. I decided to add the prefix "neg_" both to the word following "not" as well as the word before "not" (this may not make sense for the English…
0
votes
1 answer

How to express one predicate by means of another one?

I have a predicate "HAVE", now I need a predicare "don'tHave". How to create such predicate using existing predicate "HAVE"?
0
votes
0 answers

How to NOT select an element, when another certain NESTED element is preceded?

I am trying to select all
    elements that are Not preceded by a element directly Nested in a

    element. In other words I want to only select

      elements that do not follow a paragraph

      element bearing a element as their last…

Sam
  • 15,254
  • 25
  • 90
  • 145
0
votes
1 answer

c# negation operator open parenthesis expected

In C#, I'm writing code for negation operator like this, but it show syntax error, '(' expected DataTable tmp = new DataTable(); var col = tmp.Columns; if !(col.Contains("COL1") && col.Contains("COL2") && col.Contains("COL3")) { //DO STH } If I…
Pham X. Bach
  • 5,284
  • 4
  • 28
  • 42
0
votes
2 answers

Negation of Filter not working as expected in R

[Data set] X Y Z 4.98 NA NA 5.28 NA 3.21 5.12 5.14 3.16 5.09 5.12 3.18 0 0 7.12 0 0 NA d %>% filter(x==0 | y==0 | z==0 | is.na(x) | is.na(y) | is.na(z)) Above R code give me correct results where it filers the dataset and…
0
votes
0 answers

Why does this rule with `not` always return false?

I have this prolog file: daughter(anna, vera). daughter(vera, oleg). daughter(olga, pavel). daughter(olga, alla). daughter(alla, lidia). man(oleg). man(victor). man(pavel). not(P) :- (call(P) -> fail ; true). woman(X) :- not(man(X)). ?- woman(X).…
mishkamashka
  • 73
  • 1
  • 6
0
votes
1 answer

Is it redundant using !! boolean structure when the value is either true or false?

There are other questions about !! (double negation) already (here, and here), and these questions answer my confusion about this. But what I want to know with this question is more specific... Here it is my case. I have eslint set on my codebase,…
Luis Febro
  • 1,733
  • 1
  • 16
  • 21
0
votes
1 answer

How can I prove a basic inequality in dependant type language

I would like to define the following function in idris, to learn how to deal with negation: absurdity : 0 = 1 -> Void absurdity = ?how How can I do it ? Could I just create an empty lambda and let the compiler figure out that this is not equal ?
rambi
  • 1,013
  • 1
  • 7
  • 25
0
votes
1 answer

Unable to get correct behaviour from Ansible boolean variable

Jenkins has a Boolean parameter mycheck which gets passed to ansible playbook like below: ansible-playbook -i /var/myserver.hosts /var/testplay.yml -e mycheck=$mycheck The above translates to the below when the checkbox is…
Ashar
  • 2,942
  • 10
  • 58
  • 122
0
votes
1 answer

Prolog: Make double negation possible with an operator

based on my question Prolog: define logical operator in Prolog as placeholder for other operator for building a proposition-predicate now I want to make the double negation possible in prolog. Unfortunately I established: calls like (? :-…
Martin Kunze
  • 995
  • 6
  • 16
0
votes
2 answers

If-else statement error in Scheme using guile

Total newbie to Scheme here. I've been stuck on a scheme problem for sometime now. I don't understand how to code this right. I've looked every where on this site and others, and I just can't get this to work. the problem: define a function Square…
Cali_boy23
  • 19
  • 1
0
votes
1 answer

Search Field. How to code: If you cannot find a value

I wrote this JS Code $("#itemSearch").on("keyup", function () { if ($("#itemSearch").val().trim() == '') { $(".card-content").show(); } else { var value = $(this).val().trim().toLowerCase() ; $(".card-group").filter(function…