Questions tagged [equality]

Equality is a relationship between two or more items or variables or objects that exists if (1) the items are the same item, variable, or object or (2) the items are different items, variables or objects but they have the same value. This tag should generally be used with programming language specific tags as well as other contextual tags such as database system. The post should include as much context about the equality test as is possible.

This tag is typically used for questions concerning how to determine if two objects or variables are either the same object or different objects with the same value. Questions almost always require a programming language tag and other tags for context.

Programming languages represent variables, objects, or other storage containers using different underlying mechanisms for the storage of the values of variables and objects. A test for equality is to compare some characteristic of two variables or objects to determine if the characteristic is the same.

This characteristic is typically either (1) the storage identifier such as a reference handle, memory address, etc. when checking if the two are the same object or (2) the characteristic is the value of the objects retrieved using a storage identifier when checking if the value of the two are the same value.

Different programming languages and different operating environments have differences in how equality is tested and what operators are used to express a test for equality. In some cases various conversions from underlying storage representations may be involved in testing for equality.

See What is the difference between equality and equivalence? as well as Equivalence relation and natural ordering on a class in Java

2095 questions
0
votes
1 answer

How to type a function that either runs or mocks another typed method

I am trying to establish typings for what should be a fairly simple Typescript case, but something is not bound correctly. I have Actions that return typed Reactions. Complementing an Action in the framework is a Performer. This function takes an…
cefn
  • 2,895
  • 19
  • 28
0
votes
1 answer

Bootstrap not equal height on columns

I am making a website for an exam and I must make 8 categories of products which must be on two rows with equal height columns. However, the columns are not equal height when a column has more text than the others. I have tried with this way .row…
0
votes
11 answers

String issue - Java

I am writing a program for class in which I analyze different product codes entered. It is pretty simple but I am having a problem. I am trying to end a loop if a user enters an "E" or "e". However, it does not end the loop at all. This is at the…
0
votes
1 answer

Best way to check two EntitySets equality basied on one of their proprties?

I have two Objects from the same Class, lets say it named as Class1, Class1 has an EntitySet of ClassChild, What is the best way to indicate that these Two objects have the same exact ClassChild's EntitySets (values and count) based on one property…
Rami Alshareef
  • 7,015
  • 12
  • 47
  • 75
0
votes
1 answer

javascript quad equals meaning ====

reading through head first JavaScript book came across this but i have never seen four ==== or is just a bad print
0
votes
2 answers

Is there some good reason to check equality with bools?

I modified some chip manufacturer example code to remove a bunch of what I thought were stupid boolean comparisons, such as: if(var == TRUE) → if(var) if(TRUE == var) → if(var) if(var != TRUE) → if(!var) if(FALSE == var) → if(!var) if(TRUE == var1…
endolith
  • 25,479
  • 34
  • 128
  • 192
0
votes
1 answer

Strings that look the same aren't equal

Some unit tests are failing. Upon debugging, I traced the problem here var a = "USD 1,234.12" var b = "USD 1,234.12" console.log(a === b) String a has been generated by a currency formatter library and String b has been written by a unit test…
TSR
  • 17,242
  • 27
  • 93
  • 197
0
votes
1 answer

Archiving Form Responses that are NOT TODAY using google script

I am brand new to coding and trying to automate a process for a small organization. There is a form that employees fill out each day. I am attempting to write a script that I can run each morning that will remove any responses from dates that are…
0
votes
1 answer

Ruby classes seem to be the same but not considered equal

How can two objects seem to be identical but are not? Have pickle_step that runs code "model!(owner).send(association).should == model!(target)" When run in a tag (cucumber --tags @thisonescenario), owner and target are the same and the test…
ehsk
  • 99
  • 9
0
votes
1 answer

Java: get string value regardless of case sensitivity in switch-case

i have a some strings(String result) that user inserted it in app without any case-sensitivity policy user can insert such as : "fail" or "Fail" or "FAIL" and "Success" or "success" and etc . and also i have just one method for each of them like :…
mi_mo
  • 135
  • 1
  • 8
0
votes
1 answer

Java toEquals() Override to include parent class attributes

I am trying to override the toEquals method for a pojo. However I am not sure how I am able to compare the parent class attributes since super() is throwing me an error. I am trying something like this: @Override public boolean equals(Object o) { …
AKJ
  • 749
  • 6
  • 29
0
votes
2 answers

operators precedence and associativity in C

i would be grateful if somebody could help me with this problem. The book I am currently reading has a question Q What will be the output? #include void main() { int a = 3, b = 2; a = a ==b==0; printf("%d, %d",a,b); } The answer is given…
0
votes
1 answer

Matlab datetime values appear to be equal but return not equal

I have two datetime variables that appear to be the same (even using format long), but matlab says they are not equal: Any idea what's going on here? I discovered this because the setxor function told me these values were mutually exclusive. K>>…
0
votes
1 answer

Looking for the Agda module that contains decidable equality for lists

Given two lists xs and ys, I would like to obtain a value of Dec(xs ≡ ys). Does any one know the name of the standard library module which contains such an operator?
user1023733
  • 805
  • 5
  • 14
0
votes
1 answer

Add value (from 2nd dataframe) in new column (in 1st dataframe) based on equality value of another column from both dataframe in R

I am trying to add the value from each row of the column ConversionFactor (from df2) to new column ($value) of df1 when the value of same row of column (NameSize) from df1 and df2 are equals. See the code: df1$value[df2$NameSize == df1$NameSize] <-…
Grg Lulu
  • 11
  • 5
1 2 3
99
100