<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-1%3Amabd065</id>
	<title>SE250:lab-1:mabd065 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-1%3Amabd065"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-1:mabd065&amp;action=history"/>
	<updated>2026-04-29T02:15:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.kram.nz/index.php?title=SE250:lab-1:mabd065&amp;diff=4400&amp;oldid=prev</id>
		<title>Mark: 6 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-1:mabd065&amp;diff=4400&amp;oldid=prev"/>
		<updated>2008-11-03T05:18:43Z</updated>

		<summary type="html">&lt;p&gt;6 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;At the beginning, i searched google for time functions and tried to use the time() function before and &lt;br /&gt;
&lt;br /&gt;
after the for loop with no success.&lt;br /&gt;
&lt;br /&gt;
After asking for help, i was told to use the clock() function instead of time.&lt;br /&gt;
&lt;br /&gt;
After doing so, i got the following results:&lt;br /&gt;
&lt;br /&gt;
For 100,000,000 time of increasing j by one (starting at J = 0):&lt;br /&gt;
&lt;br /&gt;
Every time i run the test, a slitlty diffrent result is producted. I think this is due to how busy the processor and/or ram are on the time of running the test.&lt;br /&gt;
&lt;br /&gt;
On PC (Windows vista), the results are as follows:&lt;br /&gt;
    Rounds   First        Second       Third&lt;br /&gt;
    int:     286 ticks || 288 ticks || 289 ticks&lt;br /&gt;
    long:    305 ticks || 288 ticks || 302 ticks&lt;br /&gt;
    short:   340 ticks || 297 ticks || 288 ticks&lt;br /&gt;
    double:  342 ticks || 321 ticks || 289 ticks&lt;br /&gt;
    float:   315 ticks || 289 ticks || 288 ticks&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;time.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 int main ()&lt;br /&gt;
 {&lt;br /&gt;
 	double start,end;&lt;br /&gt;
 	double dif;&lt;br /&gt;
 &lt;br /&gt;
 	double i;&lt;br /&gt;
 &lt;br /&gt;
 	// Change the type for the J variable to get the variations i got&lt;br /&gt;
 	float j=0;&lt;br /&gt;
 &lt;br /&gt;
 	start = clock();&lt;br /&gt;
 &lt;br /&gt;
 	for (i = 0; i &amp;lt; 100000000; i++)&lt;br /&gt;
 	{&lt;br /&gt;
 		j++;&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	end = clock();&lt;br /&gt;
 	dif = end - start;&lt;br /&gt;
 &lt;br /&gt;
 	printf(&amp;quot;It took %.f ticks / %d s.\n&amp;quot;, dif , CLOCKS_PER_SEC );&lt;br /&gt;
 &lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
--[[User:Mabd065|Mabd065]] 11:47, 4 March 2008 (NZDT)&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>