Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 360960 - Modulus operation with numeric literals results in NaN
Summary: Modulus operation with numeric literals results in NaN
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-14 09:15 EDT by Kathy Carroll CLA
Modified: 2017-02-23 14:19 EST (History)
1 user (show)

See Also:


Attachments
EGL source code (3.47 KB, application/octet-stream)
2011-10-14 12:03 EDT, Kathy Carroll CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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