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

Exclude a Substring using Regex in Java

I want to take a string like src=' blah src='' blah and ignore the first src=' Expected results should be: blah src='' blah I've tried: blah(?!:(src\\s*?=\\s*?)) I've seen other posts on here mentioning ^(...).*$ but I really don't understand how…
user817129
  • 522
  • 3
  • 10
  • 19
0
votes
4 answers

What is the difference between Boolean(foo.bar) and !!foo.bar?

In javascript I have seen the usage of if (!!foo.bar) { doSomething(); } What is the performance and other differences between this and if (Boolean(foo.bar)) { doSomething(); } ? Is there any overhead for the use of constructor typecasting…
0xc0de
  • 8,028
  • 5
  • 49
  • 75
0
votes
1 answer

Space after negation in Javascript

This is a javascript coding style question. Is there any reason for putting a space after the negation operator? I've seen that in the source code of angularjs and I can't figure out if there is any benefit to this. Example: writing !myVar vs !…
Keyamoon
  • 1,785
  • 17
  • 16
0
votes
1 answer

Double negation sql query

I was asked to do a query in sql using double negation. The question itself is asking for all the "sigla" and "disciplina "where the semestre_id is 21 and has at least 1 attribute "resposta"=5 table query Now despite posting all this my question…
user697110
  • 589
  • 10
  • 25
0
votes
1 answer

prolog negation \+

There are four baskets, and each with a unique color. I write a prolog program to tell the color oder based on some facts and rules. This is the .pl file: iright(L, R, [L | [R | _]]). iright(L, R, [_ | Rest]) :- iright(L, R, Rest). nextto(L, R,…
user23256
  • 53
  • 2
  • 9
0
votes
1 answer

alias `(not)/1` in prolog

I have recieved a piece of code for an assignment called exShell. In it, the code uses (not)/1 for negation, I have currently replaced all instances with (\+)/1 but I was wondering why that would be there in the first place. Is it possible to alias…
rumble
  • 3
  • 3
-1
votes
1 answer

Trying to select a value that does not contain using jq

We have many racks of servers of three types. One type is our storage cluster using weka. All of the hostnames begin with weka. The other two are compute and GPU nodes. Both start with a common string. Next is 'r' followed by the rack number. …
user2664304
  • 27
  • 1
  • 5
-1
votes
1 answer

negation condition logic; negation

Could you help me to invert this condition in javascript? (this.startingNode.isAdaptive && this.startingNode.studentAssessment.isNotCompleted && this.user.isStudentLike) || this.isFinalAssessment
see
  • 61
  • 4
-1
votes
2 answers

why we use two conditions in head!=nullptr && head->next != nullptr in floyd cycle detection algorithm?

i want to know that why we use two conditions i am confused.. while head and head->next are not equal to null which means head and head's next will point to null ho is that possible int detectCycle(Node *& head) { Node * fast = head; Node *…
-1
votes
1 answer

Refactoring If Statements For Better Readability

I'm currently working on a project that will diminish a class that being used by other several classes. if(condition_A) { doSomething(); } else if(condition_B) { classToBeRemoved(); } else { doAnother(); } The first solution that…
Rnine
  • 13
  • 3
-1
votes
3 answers

Proof by contradiction

I'm trying to do a proof by contradiction, but don't quite understand how to write it down formally or how to come to an answer in this case. I'm doing a conditional statement. The problem I'm trying to solve is "Given the premises, h ^ ~r and (h^n)…
Howard P
  • 258
  • 3
  • 19
-1
votes
2 answers

How this sum is being calculated

I'm doing java and I'm having trouble understanding how it's calculating this sum. 5+3/2*7-8=4 How it's getting 4? The order in which arithmetic operators are applied in a calculation are as follows: 1. Negation, - 2. Multiplication and Division, *,…
TomHanks
  • 1
  • 8
-2
votes
3 answers

if statement negation in C

Hello I'm currently doing a programming exercice and there is something I want to be sure about. It is about the if statement negation like so : if(!(condition)), what's the difference between the if statement with negation and not ? Here an example…
dieri
  • 23
  • 6
-2
votes
1 answer

Positive negation in Java

How to make that after the negation operation, i.e. ~ 10 (binary: 1010), the result would not be -11 but 5, 10 = binary 1010 and after negation 0101 or 5. Thank you for help!
Vladik
  • 9
  • 1
-2
votes
2 answers

What does !! (bang bang) mean?

Can't find a reference to this anywhere -- I have the following code I'm trying to work with and can anyone please tell me what the !! means in this context? Just to be clear it's "bang bang" !! not "pipe pipe" ||. Thanks in advance! /* Branch…
GR99
  • 165
  • 8
1 2 3
16
17