Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0007260 [Squeak] VM minor always 01-04-09 20:10 04-18-10 22:06
Reporter nicolas cellier View Status public  
Assigned To lewis
Priority normal Resolution fixed  
Status closed   Product Version 3.10
Summary 0007260: some Float comparison primitives don't handle Nan correctly
Description "These should all be false, but due to primitive naive implementation some are true"
{
2.0 >= Float nan.
2.0 > Float nan.
2.0 < Float nan.
2.0 <= Float nan.
}.
"#(true false false true)"

"After correcting in image Smalltalk code, i correctly have:"
{
2000000000000 >= Float nan.
2000000000000 > Float nan.
2000000000000 < Float nan.
2000000000000 <= Float nan.
}.
 #(false false false false)

"But this doesn't happen with 2.0, because of the primitive..."
Additional Information Correction is very simple:

primitiveFloatGreaterOrEqual should call a primitiveFloatGreaterOrEqualToArg.
because, using Magnitude implementation is WRONG:

(2.0 >= Float nan) ~= (2.0 < Float nan) not

With nan, order relation is not total but partial;
thus notLessThan: is no more an order relationship...
It cannot be used as equivalent to >=
This is the same bug as 0006719
I duplicate because it requires both image and vm correction
This report is concerning the VM.

same kind of correction required for primitiveFloatLessOrEqual
Attached Files  M7260-primitiveFloatCompareNan-Test-nice.1.cs [^] (1,308 bytes) 01-04-09 20:41
 M7260-primitiveFloatCompareNan-Patch-nice.1.cs [^] (1,503 bytes) 01-04-09 20:41
 M7260-primitiveSmallIntegerCompareNan-Test-nice.1.cs [^] (960 bytes) 01-04-09 21:02
 M7260-primitiveSmallIntegerCompareNan-Patch-nice.1.cs [^] (1,656 bytes) 01-04-09 21:03
 M7260-bytecodePrimGreaterEqual-update-dtl.1.cs [^] (1,598 bytes) 07-01-09 23:11
 M7260-FloatCompareNonRegressionTest-nice.2.cs [^] (2,350 bytes) 07-06-09 01:08

- Relationships
related to 0006719closed nicolas cellier Float nan comparison is broken 

- Notes
(0012890 - 285 - 315 - 315 - 315 - 315 - 315)
nicolas cellier
01-04-09 21:06

Hehe, the patch for fixing Float primitive does not solve the problem, <= and >= are very special selector with very special handling...

#bytecodePrimLessOrEqual and #bytecodePrimGreaterOrEqual must also be changed...

So please, download the two patches and two tests I proposed.
 
(0013135 - 43 - 43 - 43 - 43 - 43 - 43)
lewis
06-12-09 11:37

Included in VMMaker-dtl.123 on SqueakSource
 
(0013140 - 866 - 1232 - 1232 - 1232 - 1232 - 1232)
lewis
07-01-09 16:54

Reopening issue base on this from vm-dev list:

On Wed, Jul 01, 2009 at 08:32:18AM -0700, Andreas Raab wrote:
>
> Ouch. Yeah, I'd say that's right...
>
> Bert Freudenberg wrote:
> >
> >I just noticed that
> >
> >bytecodePrimGreaterOrEqual
> > ...
> > aBool := self primitiveFloatLess: rcvr thanArg: arg.
> > successFlag ifTrue: [^self booleanCheat: aBool not].
> >
> >got changed to
> >
> >bytecodePrimGreaterOrEqual
> > ...
> > aBool := self primitiveFloatGreaterOrEqual: rcvr toArg: arg.
> > successFlag ifTrue: [^self booleanCheat: aBool not].
> >
> >but shouldn't that be
> >
> >bytecodePrimGreaterOrEqual
> > ...
> > aBool := self primitiveFloatGreaterOrEqual: rcvr toArg: arg.
> > successFlag ifTrue: [^self booleanCheat: aBool].
> >
> >and similarly for bytecodePrimLessOrEqual?
> >
> >- Bert -
> >
 
(0013141 - 105 - 105 - 105 - 105 - 105 - 105)
lewis
07-01-09 23:17

Added M7260-bytecodePrimGreaterEqual-update-dtl.cs to VMMaker-dtl.124 to correct error on previous patch.
 
(0013154 - 124 - 124 - 124 - 124 - 124 - 124)
lewis
07-06-09 01:38

Fix included in VMMaker-dtl.124 confirmed by Nicolas Cellier on vm-dev, with additional unit tests added to this bug report.
 

- Issue History
Date Modified Username Field Change
01-04-09 20:10 nicolas cellier New Issue
01-04-09 20:10 nicolas cellier Status new => assigned
01-04-09 20:10 nicolas cellier Assigned To  => tim
01-04-09 20:41 nicolas cellier File Added: M7260-primitiveFloatCompareNan-Test-nice.1.cs
01-04-09 20:41 nicolas cellier File Added: M7260-primitiveFloatCompareNan-Patch-nice.1.cs
01-04-09 21:02 nicolas cellier File Added: M7260-primitiveSmallIntegerCompareNan-Test-nice.1.cs
01-04-09 21:03 nicolas cellier File Added: M7260-primitiveSmallIntegerCompareNan-Patch-nice.1.cs
01-04-09 21:06 nicolas cellier Note Added: 0012890
01-06-09 11:26 lewis Issue Monitored: lewis
01-07-09 00:52 lewis Relationship added related to 0006719
06-12-09 11:37 lewis Status assigned => resolved
06-12-09 11:37 lewis Resolution open => fixed
06-12-09 11:37 lewis Note Added: 0013135
07-01-09 16:54 lewis Note Added: 0013140
07-01-09 16:54 lewis Assigned To tim => lewis
07-01-09 16:54 lewis Status resolved => acknowledged
07-01-09 23:11 lewis File Added: M7260-bytecodePrimGreaterEqual-update-dtl.1.cs
07-01-09 23:17 lewis Note Added: 0013141
07-01-09 23:17 lewis Status acknowledged => testing
07-06-09 01:08 nicolas cellier File Added: M7260-FloatCompareNonRegressionTest-nice.2.cs
07-06-09 01:38 lewis Status testing => resolved
07-06-09 01:38 lewis Note Added: 0013154
04-18-10 22:06 andreas Status resolved => closed


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
78 total queries executed.
42 unique queries executed.
Powered by Mantis Bugtracker