<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.explainxkcd.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=173.245.53.238</id>
		<title>explain xkcd - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://www.explainxkcd.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=173.245.53.238"/>
		<link rel="alternate" type="text/html" href="https://www.explainxkcd.com/wiki/index.php/Special:Contributions/173.245.53.238"/>
		<updated>2026-04-15T18:57:13Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://www.explainxkcd.com/wiki/index.php?title=1537:_Types&amp;diff=95403</id>
		<title>1537: Types</title>
		<link rel="alternate" type="text/html" href="https://www.explainxkcd.com/wiki/index.php?title=1537:_Types&amp;diff=95403"/>
				<updated>2015-06-12T22:17:12Z</updated>
		
		<summary type="html">&lt;p&gt;173.245.53.238: purge title explanation from transcript&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{comic&lt;br /&gt;
| number    = 1537&lt;br /&gt;
| date      = June 12, 2015&lt;br /&gt;
| title     = Types&lt;br /&gt;
| image     = types.png&lt;br /&gt;
| titletext = colors.rgb(&amp;quot;blue&amp;quot;) yields &amp;quot;#0000FF&amp;quot;. colors.rgb(&amp;quot;yellowish blue&amp;quot;) yields NaN. colors.sort() yields &amp;quot;rainbow&amp;quot;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Explanation==&lt;br /&gt;
{{incomplete|Title text not explained. More details before the list.}}&lt;br /&gt;
&lt;br /&gt;
This comic is a series of programming jokes about a ridiculous new programming language, perhaps inspired by [https://www.destroyallsoftware.com/talks/wat Gary Bernhardt's CodeMash 2012 lightning talk] on Javascript's unpredictable typing. The (highly technical) audience is unable to correctly guess the results of adding various Javascript types and roars with laughter when they're revealed.&lt;br /&gt;
&lt;br /&gt;
Most regular programming languages distinguish a number of types, e.g. integers , strings, lists,... All of which have different behaviours. The operation &amp;quot;+&amp;quot; is conventionally defined over more than one of these types. Applied to two integers, it returns their addition, but applied to two strings (denoted by being enclosed in quotes) it concatenates them:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;gt; 2 + 3&lt;br /&gt;
&lt;br /&gt;
5&lt;br /&gt;
&lt;br /&gt;
&amp;gt; &amp;quot;123&amp;quot; + &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;123abc&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While these behaviours are standard, conventional, and intuitive, there is a huge amount of variation among programming languages when you apply an operation like &amp;quot;+&amp;quot; to different types. One logical approach is to always return an error in all cases of type mixing, but it is often practical to allow some case mixing, since it can hugely simplify an operation. Variation and lack of a clearly more intuitive behaviour leads some languages to have weird results when you mix types.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;2 + &amp;quot;2&amp;quot;&amp;lt;/code&amp;gt; uses the &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; operator on a number and a string. In a normal language, this would result either the number &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt; (addition), or &amp;lt;code&amp;gt;&amp;quot;22&amp;quot;&amp;lt;/code&amp;gt; (string concatenation); however, the new language converts the string to an integer, adds them to produce &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt; and converts back to a string. Alternately, it is adding 2 to the ASCII value of the character &amp;lt;code&amp;gt;&amp;quot;2&amp;quot;&amp;lt;/code&amp;gt;, which (interpreted as a string) is &amp;lt;code&amp;gt;&amp;quot;4&amp;quot;&amp;lt;/code&amp;gt;. This is (somewhat) consistent with the behavior for item 4.&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;quot;2&amp;quot; + []&amp;lt;/code&amp;gt; adds a string to an array (a list), this time. This first inexplicably converts the string to a number again, and then it literally adds the number to the list by appending it (this would make sense if it was &amp;lt;code&amp;gt;[] + 2&amp;lt;/code&amp;gt;, but usually not the other way around). And then the result (the entire array) is converted to a string again.&lt;br /&gt;
# &amp;lt;code&amp;gt;(2/0)&amp;lt;/code&amp;gt; divides &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; by &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; and quite reasonably results in &amp;lt;code&amp;gt;NaN&amp;lt;/code&amp;gt; (not a number).&lt;br /&gt;
# &amp;lt;code&amp;gt;(2/0)+2&amp;lt;/code&amp;gt; adds &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;NaN&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; is &amp;quot;added&amp;quot; to the string &amp;lt;code&amp;gt;&amp;quot;NaN&amp;quot;&amp;lt;/code&amp;gt; (again, the number is converted to a string for apparently no reason), which produces &amp;lt;code&amp;gt;&amp;quot;NaP&amp;quot;&amp;lt;/code&amp;gt;, as if &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; was added to &amp;lt;code&amp;gt;&amp;quot;N&amp;quot;&amp;lt;/code&amp;gt; to produce &amp;lt;code&amp;gt;&amp;quot;P&amp;quot;&amp;lt;/code&amp;gt; (as per alphabetical order or ASCII encoding; &amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;01001110&amp;lt;/code&amp;gt;, and adding 2 to this results in &amp;lt;code&amp;gt;01010000&amp;lt;/code&amp;gt; which is &amp;lt;code&amp;gt;P&amp;lt;/code&amp;gt;).&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;quot;&amp;quot;+&amp;quot;&amp;quot;&amp;lt;/code&amp;gt; looks like it is concatenating (adding) an empty string (i.e. &amp;lt;code&amp;gt;&amp;quot;&amp;quot;&amp;lt;/code&amp;gt;) to another empty string, which should produce an empty string. However, the entire thing is treated as one string (with the start quote being the first one and the end quote being the very last one), which produces the egregious '&amp;lt;code&amp;gt;&amp;quot;+&amp;quot;&amp;lt;/code&amp;gt;'.&lt;br /&gt;
# &amp;lt;code&amp;gt;[1,2,3]+2&amp;lt;/code&amp;gt; seems to test whether it's sound to append &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; to the list &amp;lt;code&amp;gt;[1,2,3]&amp;lt;/code&amp;gt;, and concludes that it doesn't fit the pattern, returning the boolean value &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. It could conceivably also be the result of an attempt to add &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; to the ''set'' &amp;lt;code&amp;gt;[1,2,3]&amp;lt;/code&amp;gt;, which already contains that element (although &amp;lt;code&amp;gt;{1,2,3}&amp;lt;/code&amp;gt; would be a more common notation for sets).&lt;br /&gt;
# &amp;lt;code&amp;gt;[1,2,3]+4&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; for much the same reason.&lt;br /&gt;
# &amp;lt;code&amp;gt;2/(2-(3/2+1/2))&amp;lt;/code&amp;gt; is a floating point joke. Floating point numbers are notoriously imprecise. With precise mathematics, &amp;lt;code&amp;gt;(3/2+1/2)&amp;lt;/code&amp;gt; would be exactly 2, hence the entire thing would evaluate to &amp;lt;code&amp;gt;2/0&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;NaN&amp;lt;/code&amp;gt; in Randall's new language. However, the result of &amp;lt;code&amp;gt;(3/2+1/2)&amp;lt;/code&amp;gt; is &amp;quot;just slightly off,&amp;quot; which makes the result &amp;quot;just slightly off&amp;quot; of &amp;lt;code&amp;gt;NaN&amp;lt;/code&amp;gt; (which would be ridiculous in a real language). The ironic thing is that fractions with 2 in the denominator are ''not'' the kind of numbers that typically suffer from floating point impreciseness. Additionally, if there was indeed a rounding error, the actual calculation becomes something like &amp;lt;code&amp;gt;2/0.0000000000000013&amp;lt;/code&amp;gt;, which should not return a &amp;lt;code&amp;gt;NaN&amp;lt;/code&amp;gt; since it is not division by zero.&lt;br /&gt;
# &amp;lt;code&amp;gt;range(&amp;quot; &amp;quot;)&amp;lt;/code&amp;gt; normally wouldn't make any sense. However, the new language appears to interpret it as ASCII, and in the ASCII table, character #32 is space, #33 is &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;, and #34 is &amp;lt;code&amp;gt;&amp;quot;&amp;lt;/code&amp;gt;. So, instead of interpreting &amp;lt;code&amp;gt;&amp;quot; &amp;quot;&amp;lt;/code&amp;gt; as a string, it seems to be interpreted as &amp;lt;code&amp;gt;34, 32, 34&amp;lt;/code&amp;gt; (in ASCII), and then &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt; appears to transform this into &amp;lt;code&amp;gt;34, 33, 32, 33, 34&amp;lt;/code&amp;gt; (the &amp;quot;ranges&amp;quot; between the numbers), which, interpreted as ASCII, becomes &amp;lt;code&amp;gt;['&amp;quot;', '!', ' ', '!', '&amp;quot;']&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &amp;lt;code&amp;gt;+2&amp;lt;/code&amp;gt; refers to the Chinese/Japanese (Kanji) number system, where the plus sign is instead the symbol &amp;lt;code&amp;gt;十&amp;lt;/code&amp;gt;. In Chinese, this symbol represents the number ten, and if you translate the &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; into Chinese, you get &amp;lt;code&amp;gt;二&amp;lt;/code&amp;gt;. Therefore, in full Chinese the code is &amp;lt;code&amp;gt;十二&amp;lt;/code&amp;gt; is equivalent to the number &amp;lt;code&amp;gt;12&amp;lt;/code&amp;gt;&lt;br /&gt;
# &amp;lt;code&amp;gt;2+2&amp;lt;/code&amp;gt; would normally be &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt;. However, the interpreter takes this instruction to mean that the user wishes to increase the actual value of the number &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; (aka the &amp;quot;literal value&amp;quot;) by &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; for the remainder of the program, making it &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt; and then reports that the work is &amp;quot;Done&amp;quot;.  The result can be seen in the subsequent lines where all &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;s are replaced by &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt;s.  This could be a reference to languages like Fortran where [http://everything2.com/title/Changing+the+value+of+5+in+FORTRAN literals could be assigned new values].&lt;br /&gt;
# &amp;lt;code&amp;gt;range(1,5)&amp;lt;/code&amp;gt; would normally return &amp;lt;code&amp;gt;[1, 2, 3, 4, 5]&amp;lt;/code&amp;gt;. However, since the value of &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; has been changed to &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt;, it returns &amp;lt;code&amp;gt;[1, 4, 3, 4, 5]&amp;lt;/code&amp;gt;, and this even affects the line number (which is 14 instead of 12).         &lt;br /&gt;
# &amp;lt;code&amp;gt;floor(10.5)&amp;lt;/code&amp;gt; should return &amp;lt;code&amp;gt;10&amp;lt;/code&amp;gt; (the &amp;quot;floor&amp;quot; of a decimal number is that number rounded down). However, it instead returns {{w|ASCII art}} of the number on a &amp;quot;floor.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The title text contains three further examples relating to color. &amp;lt;code&amp;gt;color.rgb(&amp;quot;blue&amp;quot;)&amp;lt;/code&amp;gt; returns the hexadecimal code for pure blue (as would be used in HTML, for example), which is how a real programming language might work. The lookup for &amp;quot;yellowish blue&amp;quot; returns &amp;quot;NaN&amp;quot; (Not a Number) again, which makes sense at one level because there is no such color as &amp;quot;yellowish blue&amp;quot; (yellow and blue make green). However a more typical result would have been a failure indicating that the color database does not include the name, in the same way that a typo such as &amp;quot;bluw&amp;quot; would. Similarly sorting the colors would normally produce some defined ordering, such as alphabetical, but in this language it generates the string &amp;quot;rainbow&amp;quot;. It seems that Randall's new language understands color theory in an unusually deep way.&lt;br /&gt;
&lt;br /&gt;
==Transcript==&lt;br /&gt;
My new language is great, but it has a few quirks regarding type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 [1]&amp;gt; 2+&amp;quot;2&amp;quot;&lt;br /&gt;
   =&amp;gt; &amp;quot;4&amp;quot;&lt;br /&gt;
 [2]&amp;gt; &amp;quot;2&amp;quot;+[]&lt;br /&gt;
   =&amp;gt; &amp;quot;[2]&amp;quot;&lt;br /&gt;
 [3]  (2/0)&lt;br /&gt;
   =&amp;gt; NaN&lt;br /&gt;
 [4]&amp;gt; (2/0)+2&lt;br /&gt;
   =&amp;gt; NaP&lt;br /&gt;
 [5]&amp;gt; &amp;quot;&amp;quot;+&amp;quot;&amp;quot;&lt;br /&gt;
   =&amp;gt; '&amp;quot;+&amp;quot;'&lt;br /&gt;
 [6]&amp;gt; [1,2,3]+2&lt;br /&gt;
   =&amp;gt; FALSE&lt;br /&gt;
 [7]&amp;gt; [1,2,3]+4&lt;br /&gt;
   =&amp;gt; TRUE&lt;br /&gt;
 [8]&amp;gt; 2/(2-(3/2+1/2))&lt;br /&gt;
   =&amp;gt; NaN.0000000000000013&lt;br /&gt;
 [9]&amp;gt; range(&amp;quot; &amp;quot;)&lt;br /&gt;
   =&amp;gt; ('&amp;quot;','!',&amp;quot; &amp;quot;,&amp;quot;!&amp;quot;,'&amp;quot;')&lt;br /&gt;
[10]&amp;gt; +2&lt;br /&gt;
   =&amp;gt; 12&lt;br /&gt;
[11]&amp;gt; 2+2&lt;br /&gt;
   =&amp;gt; DONE&lt;br /&gt;
[14]&amp;gt; RANGE(1,5)&lt;br /&gt;
   =&amp;gt; (1,4,3,4,5)&lt;br /&gt;
[13]&amp;gt; FLOOR(10.5)&lt;br /&gt;
   =&amp;gt; |&lt;br /&gt;
   =&amp;gt; |&lt;br /&gt;
   =&amp;gt; |&lt;br /&gt;
   =&amp;gt; |&lt;br /&gt;
   =&amp;gt; |___10.5___&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{comic discussion}}&lt;/div&gt;</summary>
		<author><name>173.245.53.238</name></author>	</entry>

	<entry>
		<id>https://www.explainxkcd.com/wiki/index.php?title=Talk:953:_1_to_10&amp;diff=90587</id>
		<title>Talk:953: 1 to 10</title>
		<link rel="alternate" type="text/html" href="https://www.explainxkcd.com/wiki/index.php?title=Talk:953:_1_to_10&amp;diff=90587"/>
				<updated>2015-04-22T08:16:49Z</updated>
		
		<summary type="html">&lt;p&gt;173.245.53.238: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;1.(1) is the best answer I've got [[User:Halfhat|Halfhat]] ([[User talk:Halfhat|talk]]) 11:53, 5 April 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;How likely&amp;quot; it is? As everyone knows, &amp;quot;every base is base 10&amp;quot;, since every base number in its own numbering system is written as &amp;quot;10&amp;quot; (2 is 10 in binary, 16 is 10 in hex and so on). So that question could be in EVERY number system possible. There are an '''infinite amount of number systems''' that use the symbols 1 and 0. I suppose the probability is then 1 over an infinite number of systems, then very unlikely, so I'd say (as 0 is not in the range of possible answers) the answer is 1. Which, incidentally, is also an acceptable answer for every system. If we want instead to take into account that Megan doesn't know what a 4 is, the possibilities are only base 2, 3 and 4. So the likeliness is 1/3, which corresponds anyway to 1 in those number systems. --[[Special:Contributions/108.162.229.31|108.162.229.31]] 14:05, 3 June 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
If we assume '''the question was auditory''' to the questioned, the way '10' was articulated is another source of information: the enquirer can pronounce '10' as ''&amp;quot;ten&amp;quot;'' or ''&amp;quot;one zero&amp;quot;''. &lt;br /&gt;
In the first case, if he said ''&amp;quot;ten&amp;quot;'', this points towards the base system being greater than/equal to 10. For example ''&amp;quot;ten&amp;quot;'' would be &amp;quot;10&amp;quot; in decimal (base 10) and &amp;quot;16&amp;quot; in hexadecimal (base 16). The word &amp;quot;ten&amp;quot; stops making sense for bases 2 through 9, which leads us to the conclusion of this case: the probability of the question being base 2 is zero, therefore the closest possible score one can give is 1.&lt;br /&gt;
In the case that &amp;quot;10&amp;quot; is pronounced ''&amp;quot;one zero&amp;quot;'': using the same logic as in the first case, the question can use any base 2 through 9. giving us a probability of 1/8, the nearest score again being 1. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So if the question were: &amp;quot;On a scale from one to one zero, how likely is this question using the decimal system?&amp;quot; Could be answered with full confidence&lt;br /&gt;
&lt;br /&gt;
One of correct answers is P = 1 + 1 - |sgn(10 - 1 - 1)|&lt;br /&gt;
&lt;br /&gt;
(|x| is absolute value of x, sgn(x) is 1 when x &amp;gt; 0, 0 when x = 0, and -1 when x &amp;lt; 0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If 10 = 1 + 1, then P = 10 - |sgn(0)| = 10 - |0| = 10&lt;br /&gt;
&lt;br /&gt;
If 10 &amp;gt; 1 + 1, then P = 1 + 1 - |sgn(10 - 1 - 1)| = 1 + 1 - |1| = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If 10 &amp;lt; 1 + 1, then P = 1 + 1 - |sgn(10 - 1 - 1)| = 1 + 1 - |-1| = 1&lt;br /&gt;
&lt;br /&gt;
So P is 10 iif the question was is in binary, and 1 iif it was not in binary.&lt;br /&gt;
&lt;br /&gt;
[[Special:Contributions/93.73.186.104|93.73.186.104]] 16:26, 6 February 2013 (UTC)&lt;br /&gt;
:The absolute value is unnecessary. When is 10 ever less than 1+1?[[Special:Contributions/108.162.219.202|108.162.219.202]] 20:28, 3 January 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
I don't think the explanation is right, I mean i don't know binary but i don't think the joke is that he's saying a 4 as in 100% [[User:Lackadaisical|Lackadaisical]] ([[User talk:Lackadaisical|talk]]) 00:23, 7 November 2013 (UTC)&lt;br /&gt;
:A 4 is not 100%, but a 3/4 is always 75%. [[Special:Contributions/108.162.212.206|108.162.212.206]] 22:47, 26 January 2014 (UTC)&lt;br /&gt;
:Actually, my comment was in reference to this: &amp;quot;Since 4 in binary is &amp;quot;100&amp;quot; (one-zero-zero) the joke is that it is 100% likely that the question is binary -- or it could simply be 4 of 10 - which means that the question has evolved into recursive ambiguity. Also, the person asking the question does not know what a 4 is since there is no 4 in binary.&amp;quot; The problem I had with it was taken care of in a previous edit (The quote was taken from the 31 December 2013 edit.)--[[User:Lackadaisical|Lackadaisical]] ([[User talk:Lackadaisical|talk]]) 22:03, 26 March 2015 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                                                    &lt;br /&gt;
It seems that the best answer to this question is 1.11111... because it approaches 10 in binary, and is very low in almost any other number system. {{unsigned ip|173.245.54.169}}&lt;/div&gt;</summary>
		<author><name>173.245.53.238</name></author>	</entry>

	</feed>