<div dir="ltr"><div>Once upon a Time, there could have been a literal nan...<br>Yes, in Squeak 3.8 or 3.9 when formed thru (<a name="bugnotes" id="bugnotes">&#39;0.&#39; , (String new: 320 withAll: $0) , &#39;1e321&#39;</a>) - see <a href="http://bugs.squeak.org/view.php?id=6982">http://bugs.squeak.org/view.php?id=6982</a><br>Let&#39;s consider this case rare and accidental...<br></div><div>Now, even if literalEqualityOfNan is a bit like unreachable, let&#39;s consider this as a future proof test...<br></div> <br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-10-27 21:53 GMT+01:00  <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/KernelTests-nice.280.mcz" target="_blank">http://source.squeak.org/trunk/KernelTests-nice.280.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: KernelTests-nice.280<br>
Author: nice<br>
Time: 27 October 2014, 9:53:44.861 pm<br>
UUID: fc50e9f5-10d8-45d8-8c9e-e80806596878<br>
Ancestors: KernelTests-dtl.279<br>
<br>
Two more expectations for float literal equality:<br>
- zero and negativeZero are equal but not #literalEqual:<br>
- nan are not equals but can be #literalEqual:<br>
<br>
Thanks to Kris Gybels for reporting this case at <a href="https://pharo.fogbugz.com/f/cases/14316/" target="_blank">https://pharo.fogbugz.com/f/cases/14316/</a><br>
<br>
=============== Diff against KernelTests-dtl.279 ===============<br>
<br>
Item was added:<br>
+ ----- Method: FloatTest&gt;&gt;testLiteralEqualityOfNan (in category &#39;testing compare&#39;) -----<br>
+ testLiteralEqualityOfNan<br>
+       | nan |<br>
+       nan := Float nan.<br>
+       self assert: (nan literalEqual: nan)<br>
+               description: &#39;Float nan is not equal to itself, though it is literally equal&#39;.!<br>
<br>
Item was added:<br>
+ ----- Method: FloatTest&gt;&gt;testLiteralEqualityOfZeroAndNegativeZero (in category &#39;testing compare&#39;) -----<br>
+ testLiteralEqualityOfZeroAndNegativeZero<br>
+       self assert: -1<br>
+               equals: (Compiler evaluate: &#39;1&gt;2 ifTrue: [0.0] ifFalse: [-0.0]&#39;) sign<br>
+               description: &#39;Float zero and negativeZero are not literally substituable&#39;.!<br>
<br>
<br>
</blockquote></div><br></div>