<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">'0.' , (String new: 320 withAll: $0) , '1e321'</a>) - see <a href="http://bugs.squeak.org/view.php?id=6982">http://bugs.squeak.org/view.php?id=6982</a><br>Let's consider this case rare and accidental...<br></div><div>Now, even if literalEqualityOfNan is a bit like unreachable, let'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"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></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>>testLiteralEqualityOfNan (in category 'testing compare') -----<br>
+ testLiteralEqualityOfNan<br>
+ | nan |<br>
+ nan := Float nan.<br>
+ self assert: (nan literalEqual: nan)<br>
+ description: 'Float nan is not equal to itself, though it is literally equal'.!<br>
<br>
Item was added:<br>
+ ----- Method: FloatTest>>testLiteralEqualityOfZeroAndNegativeZero (in category 'testing compare') -----<br>
+ testLiteralEqualityOfZeroAndNegativeZero<br>
+ self assert: -1<br>
+ equals: (Compiler evaluate: '1>2 ifTrue: [0.0] ifFalse: [-0.0]') sign<br>
+ description: 'Float zero and negativeZero are not literally substituable'.!<br>
<br>
<br>
</blockquote></div><br></div>