Talk:Relational operator
From Wikipedia, the free encyclopedia
This is the relational operator talk page. Add new comments at the bottom.
Contents |
[edit] ===
What about Congruent to, as opposed to equal to? --Svippong 13:33, 12 April 2006 (UTC)
Congruent to tends to mean something geometric--Relational operators aren't geometric --223ankher 23:35, 17 May 2006 (UTC)
- 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)
[edit] does alpha equivients belong in this article?
eq, le, lt, etc... ? Bytebear 05:32, 19 April 2007 (UTC)
[edit] Merge == (or "eqeq") here
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)
[edit] Merge Comparison operator here
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)
[edit] Relational vs Equality
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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
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)