Jump to content

Talk:Relational operator

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

===

[edit]

What about Congruent to, as opposed to equal to? --Svippong 13:33, 12 April 2006 (UTC)[reply]

Congruent to tends to mean something geometric--Relational operators aren't geometric --223ankher 23:35, 17 May 2006 (UTC)[reply]

For instance in PHP among other languages, === is sometimes used: if ($var===true) or if($var!==true). Or am I missing the correct naming? --[Svippong - Talk] 22:36, 18 May 2006 (UTC)[reply]
What's up with "x == 0" is always false (as PHP, like other languages, equate 0 to false)  ? Any links to back it up? -- Jokes Free4Me (talk) 15:24, 31 July 2008 (UTC)[reply]
Apparently, this page seems to indicate the exact opposite. But the point is x==0 is true for more than just x being 0, also for x being "0" or false. Let me fix that. --Svippong 15:37, 31 July 2008 (UTC)[reply]

does alpha equivients belong in this article?

[edit]

eq, le, lt, etc... ? Bytebear 05:32, 19 April 2007 (UTC)[reply]

Merge == (or "eqeq") here

[edit]

The article "==" is a horrible name for an article. (I had to create a redirect named "eqeq" to the article in order to use the {{mergefrom}} template, which is why you don't see "==" there). It would seem reasonable to merge most of the content into this article. +mt 01:26, 16 July 2007 (UTC)[reply]

Done. +mt 02:26, 19 July 2007 (UTC)[reply]

Table 6.1 (page177) of "C Primer Plus" 4th Ed. by Stephen Prata tells me these are "Relational Operators". The Comparison operator article has almost identical information to this article, and also has fewer links. Merge? +mt 02:26, 19 July 2007 (UTC)[reply]

Done. +mt 18:37, 19 July 2007 (UTC)[reply]

Relational vs Equality

[edit]

Most programming languages distinguish between relational and equality operations. The relational article might call out that equality is sometimes viewed as a special case of relational, I think it is worthwhile having two articles (I agree the == is a horrible title).

Both articles do need more work. Derek farn 19:38, 19 July 2007 (UTC)[reply]

Can you cite any sources that specifically distinguish "relational operators" and "equality operators"? My sources lump these into one table and call them:
  • "relational operators" ("C Primer Plus", 4th Ed., Stephen Prata; "FORTRAN 77 Programming", 2nd Ed., T.M.R. Ellis; "Practical C++ Programming", Steve Oualline)
  • "comparison relations" ("Writing Excel Macros with VBA", 2nd Ed., Steven Roman)
  • "relational expressions" ("Fortran 90 For Engineers and Scientists", L.R. Nyhoff and S.C. Leestma),
  • "relationship operators" ("Access 2003 Bible", Cary, Irwin, and Reardon)
  • "comparison operator" ("Learning Python" 2nd Ed., Lutz and Ascher; "Handbook of Mathematics and Computational Science", Harris and Stocker; "Using JavaScript", Paul McFedries)
I think we can agree these terms are describing the same types of binary operators (with grey area on "identity" operators). Now as far as splitting "equals" from the other "inequalities" (≠,≤,≥,<,>), is this what you are suggesting? These are all similar binary operators, and I think that it would be beneficial to describe them all in a single article—just as the sources I pointed out had done. Could you describe any benefits by having two articles? (Also hold on any editing until this is cleared, as I was in the process of improving parts of the article that I'd rather not loose or have to merge.) +mt 21:15, 19 July 2007 (UTC)[reply]
To get down to this level of detail you need to look at the specification of various programming languages. The ISO programming standards committee web page is a good place to start. This don't have the final version of the standards, but there are various drafts available (I have a Fortran draft called 06-007r1.pdf and an Ada document called RM-Final.pdf, search for WG14/N1124 to find a C draft). I would be tempted to merge the two concepts into a single article were it not for the various different concepts of equality that exist (check out the specification of the Scheme language for details; this supports equality in terms of two pointers being equal, two pointers being unequal but the pointed to objection being equal, and two pointers being unequal but the pointed to linked list being the same). There is also the somewhat surprising (at least initially) behavior of some floating-point values (eg, +0 and -0 comparing equal, relational operations on NaN always failing, etc). Derek farn 00:03, 20 July 2007 (UTC)[reply]
Granted that yes, the equality operator can be complicated, I think that these can be briefly discussed within a section of this article. The overall goal for any article is to strive for simplicity, and indeed all the references I have discuss these operators in the same table/section. I understand what you are saying about the numerical and identiy concepts of equality, however, there is very little mention of identity equality in my version (current-1), and I was planning to expand this a bit more to bring light to the difference with the numerical equality operator. Could I then suggest that this article be about the relational operators in the context of the magnitudes of numbers (including equality in the sense of 5==5, along with 5>=5, 6>5, etc.)? A different article can be created that deals with the equality in a non-magnitude sense, such as addresses and objects. I would expect this article to be more detailed, and programming language specific, as your references suggest. Perhaps it could be called Identity operator or Identity relational operator? +mt 03:14, 20 July 2007 (UTC)[reply]
I think the articles are too programming language centric. Perhaps they should be broadened to include mathematics. With regard to the type of the values being compared, I think character sequences do need to be covered. Unicode has some quite sophisticated rules for comparing character sequences. I have just double checked my copy of the Fortran Standard and equality is classified as a relational operation :-O. Why not work on the relational article, leaving the equality article as-is, and see how things pan out? I suspect that there will be some topics that have a better fit in one than the other. Derek farn 03:55, 20 July 2007 (UTC)[reply]
This is a programming-centric article. The other ones (equality and inequality) deal with the math/logic side just fine. Yes, I see and agree with your cited Fortran standard—as do all the references I pointed out. The content I moved from == needs to go somewhere, so how about here, for now, then let it "pan out" (in regards to non-numerical equality) and possibly split off to a new article. Agree to revert back to the version I had going (which besides the merge, I had added other info)? I'll sort it out so the non-numerical equality stuff so that it is distinct, and could possibly be split off at some point. +mt 04:40, 20 July 2007 (UTC)[reply]
Ok, to revert my revert. More double checking shows that the post-C languages separate out relational/equality and earlier languages don't (ie, they have fewer levels of precedence). Derek farn 11:28, 20 July 2007 (UTC)[reply]
Right-O, done ... there might need to be more work on the non-numerical equality stuff, and I think some other things could be mentioned in Identity (object-oriented programming). The +0 vs −0 content should also be included at some point, but I don't know enough about this to add anything substantial (e.g., 4.0 * 3.0 may not == 2.0 * 6.0 due to floating point things). +mt 20:00, 20 July 2007 (UTC)[reply]


Just a quarry about the doesn't equal sign in print, E.G ≠. Is there an Alt command to use it on my keyboard? 68.205.161.84 17:12, 1 September 2007 (UTC)[reply]

No, there isn't. +mt 17:34, 1 September 2007 (UTC)[reply]

"Most shells"

[edit]

Ok, now let's see if "most shells" use these operators:

using these operators
AFAIK not using these operators

Ghettoblaster (talk) 22:21, 11 November 2008 (UTC)[reply]

Okay, okay, I see your point. Now I'm at a bit of a loss as to what to call the category, since Unix-like does not apply for Windows PowerShell (although I see it is influenced by ksh, which is certainly a Unix shell). For now, I've replaced "Most" with "Bourne-like" until a better name comes up. If you can think up something better to describe the family of shells, you can update it. Whatever name is used doesn't really matter a whole lot, since the details are described in the footnote. +mt 23:43, 11 November 2008 (UTC)[reply]

Object Identity in Pascal

[edit]

The article states that the expression a^ = b^ in Pascal tests whether a and b are physically equal (same entity) as opposed to structurally equal (same content).

This is not correct. In Pascal the ^ is the pointer dereferencing operator. The expression a^ dereferences pointer a, it returns the value of the target that a points to.

Therefore, the expression a^ = b^ tests whether the target of a has the same value as the target of b.

Even if the expression evaluates true, it does not mean that a and b point to the same target.

Instead, the expression a = b tests whether a and b point to the same target (assuming a and b are pointers).

Thus in Pascal, a = b tests shallow equality if a and b are pointers, it tests deep equality if a and b are not pointers. — Preceding unsigned comment added by 37.160.116.23 (talk) 22:23, 15 October 2013 (UTC)[reply]

My banking accounts information

[edit]

Find all balances and account numbers 99.188.191.33 (talk) 15:49, 31 January 2023 (UTC)[reply]

The redirect != has been listed at redirects for discussion to determine whether its use and function meets the redirect guidelines. Readers of this page are welcome to comment on this redirect at {{Section link}}: required section parameter(s) missing until a consensus is reached. TartarTorte 01:35, 21 May 2023 (UTC)[reply]

Equality > Usage paragraph

[edit]

The article states "Equality is used in many programming language constructs and data types. It is used to test if an element already exists in a set, or to access to a value through a key. It is used in switch statements to dispatch the control flow to the correct branch, and during the unification process in logic programming." This is hard for me to understand could this be more elaborated, preferably with examples. In which languages testing if an element is in a set is done with the equal sign? In which languages equality is used to access to(?) a value through a key. etc

And shouldn't it be 'the equality operator is used ...' . BartYgor (talk) 14:04, 23 October 2023 (UTC)[reply]