<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/13076" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2007-02-06T14:24:32-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/13076</id>

		<entry>
		<author><name><![CDATA[metroid]]></name></author>
		<updated>2007-02-06T14:24:32-04:00</updated>

		<published>2007-02-06T14:24:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70240#p70240</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70240#p70240"/>
		<title type="html"><![CDATA[calculate % between two rows]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70240#p70240"><![CDATA[
Using braces in expr is faster so I'd recommend using the first option.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5078">metroid</a> — Tue Feb 06, 2007 2:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2007-02-05T15:38:13-04:00</updated>

		<published>2007-02-05T15:38:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70218#p70218</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70218#p70218"/>
		<title type="html"><![CDATA[calculate % between two rows]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70218#p70218"><![CDATA[
<blockquote class="uncited"><div>% format %.2f 2.85714285714<br>2.86</div></blockquote>Edit: user did include that in his code <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Mon Feb 05, 2007 3:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[heman]]></name></author>
		<updated>2007-02-05T06:25:31-04:00</updated>

		<published>2007-02-05T06:25:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70215#p70215</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70215#p70215"/>
		<title type="html"><![CDATA[calculate % between two rows]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70215#p70215"><![CDATA[
ok that works, thanks.<br><br>Final question  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"> <br><br>the output now looks like for example:<br><blockquote class="uncited"><div>2.85714285714 %</div></blockquote>Is it possible it wil only announce the first one or two after the "." ?<br><br>So someting like:<blockquote class="uncited"><div>2.85 %</div></blockquote>And thanks for all the help<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8556">heman</a> — Mon Feb 05, 2007 6:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2007-02-05T06:08:25-04:00</updated>

		<published>2007-02-05T06:08:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70214#p70214</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70214#p70214"/>
		<title type="html"><![CDATA[calculate % between two rows]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70214#p70214"><![CDATA[
add the ".0" to your static value (100) or remove the braces...<div class="codebox"><p>Code: </p><pre><code>% set a 3; set b 7% format %.2f [expr {($a*100.0)/$b}]42.86% format %.2f [expr ($a.0*100)/$b]42.86</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Mon Feb 05, 2007 6:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[heman]]></name></author>
		<updated>2007-02-05T05:44:55-04:00</updated>

		<published>2007-02-05T05:44:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70213#p70213</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70213#p70213"/>
		<title type="html"><![CDATA[calculate % between two rows]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70213#p70213"><![CDATA[
ok that works, sort of.<br><br>cnupdt = 7<br>cnt =175<br><br>7 x 100 / 175 =  4 so it announces -&gt; 4<br><br><br>cnupdt = 5<br>cnt =175<br><br>5 x 100 / 175 = 2,86 but it announces -&gt; 2<br><br>Is there a way it announce -&gt; 2,86 ?<br><br><br><a href="http://www.tcl.tk/man/tcl8.4/TclCmd/expr.htm" class="postlink">http://www.tcl.tk/man/tcl8.4/TclCmd/expr.htm</a><blockquote class="uncited"><div>expr 5 / 4<br><br>returns 1, while <br><br>expr 5 / 4.0<br><br>return 1.25</div></blockquote>I tried<div class="codebox"><p>Code: </p><pre><code>set perc [expr {($cnupdt.0*100)/$cnt}]instead ofset perc [expr {($cnupdt*100)/$cnt}]</code></pre></div>But that didnt worked.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8556">heman</a> — Mon Feb 05, 2007 5:44 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-02-04T20:08:46-04:00</updated>

		<published>2007-02-04T20:08:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70211#p70211</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70211#p70211"/>
		<title type="html"><![CDATA[calculate % between two rows]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70211#p70211"><![CDATA[
Yup, type conversion and order of operations.<br>With tcl, if you divide two integers, the result will also be an integer (using truncation). And since percent is less than 1, you'll always get 0.<br><br>You'll either have to do the multiplication first, or convert the numbers to floats (I'd say the first is easier)<br><br>Try this:<div class="codebox"><p>Code: </p><pre><code>set perc [expr {($cnupdt*100)/$cnt}]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sun Feb 04, 2007 8:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[heman]]></name></author>
		<updated>2007-02-04T19:14:57-04:00</updated>

		<published>2007-02-04T19:14:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70209#p70209</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70209#p70209"/>
		<title type="html"><![CDATA[calculate % between two rows]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70209#p70209"><![CDATA[
I tried<br><div class="codebox"><p>Code: </p><pre><code>set perc [expr { $cnupdt / $cnt * 100 }]</code></pre></div>but results is : 0<br><br>Am I missing something?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8556">heman</a> — Sun Feb 04, 2007 7:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-02-03T16:41:57-04:00</updated>

		<published>2007-02-03T16:41:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70189#p70189</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70189#p70189"/>
		<title type="html"><![CDATA[calculate % between two rows]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70189#p70189"><![CDATA[
You probably would like to investigate the <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/expr.htm" class="postlink">expr</a> command.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Feb 03, 2007 4:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[heman]]></name></author>
		<updated>2007-02-03T15:00:52-04:00</updated>

		<published>2007-02-03T15:00:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70186#p70186</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70186#p70186"/>
		<title type="html"><![CDATA[calculate % between two rows]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70186#p70186"><![CDATA[
I have to colums: "nm" and "update"<br><br>To count the inputs i use the folowing codes:<div class="codebox"><p>Code: </p><pre><code>set cnt [mysqlsel $db "select count(*) from $table WHERE nm = '$text';" -list]set cnupdt [mysqlsel $db "select count(*) from $table WHERE update = '$text';" -list]</code></pre></div>This gives announcemnet liek this:<blockquote class="uncited"><div>&lt;botname&gt; 100 releases in db, 50 are updated </div></blockquote>Now I want to make a variable that will tell the percentage updates are made from nm<br><br>Someting like:<blockquote class="uncited"><div>&lt;botname&gt; 100 releases in db, 50 are updated (50%)</div></blockquote>Thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8556">heman</a> — Sat Feb 03, 2007 3:00 pm</p><hr />
]]></content>
	</entry>
	</feed>
