Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360960

Summary: Modulus operation with numeric literals results in NaN
Product: z_Archived Reporter: Kathy Carroll <carrollk>
Component: EDTAssignee: Project Inbox <edt.javascriptgen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jspadea
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
EGL source code none

Description Kathy Carroll CLA 2011-10-14 09:15:34 EDT
package mine;
handler Minor type RUIhandler{initialUI =[], onConstructionFunction = start, cssFile = "css/ZZTest.css", title = "Minor"}

    
    function start()
    	syslib.writestdout("starting");
    	testing();
    	testing2();
    	syslib.writestdout("stopping");
    end
    
    function testing()
    	intActual int = 75 % 2;
		intExpect int = 1;
		syslib.writestdout("75 % 2");
		if (intActual == intExpect)
			syslib.writestdout("good");
		else
			syslib.writeStdout("bad " + intActual );
		end
	end
	
	function testing2()
    	intActual int = 75 % -2;
		intExpect int = 1;
		syslib.writestdout("75 % -2");
		if (intActual == intExpect)
			syslib.writestdout("good");
		else
			syslib.writeStdout("bad " + intActual );
		end
	end
end

generates this output

starting
75 % 2
bad NaN
75 % -2
bad NaN
stopping
Comment 1 Kathy Carroll CLA 2011-10-14 12:03:55 EDT
Created attachment 205213 [details]
EGL source code

Additional test variations  issue with smallint
Comment 2 Justin Spadea CLA 2011-10-20 12:32:48 EDT
I hit this problem today and it was blocking me, so I fixed part of it. Updated FloatTypeTemplate, SmallfloatTypeTemplate, and SmallintTypeTemplate.

The two variations you have commented out still fail, but the others now work.

The problem had to do with an extra set of parens being generated, e.g. "egl.remainder((1,2))" instead of "egl.remainder(1,2)".
Comment 3 Kathy Carroll CLA 2011-10-21 12:59:45 EDT
this defect has been resolved.  commented out variations are covered by another defect 360947
Comment 4 Kathy Carroll CLA 2011-10-21 13:00:06 EDT
verified with 201110210902 and closed