<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1012756" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1012756</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/formating-integer-values#comment-1073850</link>
    <description> &lt;p&gt;thank you, i&#039;ll try it...&lt;br /&gt;
&lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Fri, 10 Nov 2000 06:18:17 +0000</pubDate>
 <dc:creator>merlin</dc:creator>
 <guid isPermaLink="false">comment 1073850 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/formating-integer-values#comment-1073799</link>
    <description> &lt;p&gt;Hi, someone helped me in another forum and I think this may well work, although I am yet to try it out.&lt;/p&gt;
&lt;p&gt;$formatted_num = sprintf(&quot;%.2f&quot;, $original_num);&lt;/p&gt;
&lt;p&gt;I guess just change &quot;%.2f&quot; to the number of decimal places you need, ie: &quot;%.3f&quot; for three decimal places.&lt;/p&gt;
&lt;p&gt;Denise&lt;/p&gt;
 </description>
     <pubDate>Thu, 09 Nov 2000 17:16:16 +0000</pubDate>
 <dc:creator>Denise</dc:creator>
 <guid isPermaLink="false">comment 1073799 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>quite similar</title>
    <link>https://www.webmaster-forums.net/serverside-scripting/formating-integer-values#comment-1073797</link>
    <description> &lt;p&gt;hu, i have quite the same question (now that you&#039;re talking about... &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt; ) :&lt;br /&gt;
i have an integer like 10 or 10.5 and i&#039;d like to display it with two decimals: 10.00 (10.50)&lt;br /&gt;
so, it&#039;s not less a rounding question than a display-thing...&lt;/p&gt;
 </description>
     <pubDate>Thu, 09 Nov 2000 16:30:28 +0000</pubDate>
 <dc:creator>merlin</dc:creator>
 <guid isPermaLink="false">comment 1073797 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/formating-integer-values#comment-1073794</link>
    <description> &lt;p&gt;Cheers Guys,&lt;/p&gt;
&lt;p&gt;I&#039;ll give these a try!&lt;/p&gt;
&lt;p&gt;Denise &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Thu, 09 Nov 2000 15:07:05 +0000</pubDate>
 <dc:creator>Denise</dc:creator>
 <guid isPermaLink="false">comment 1073794 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/formating-integer-values#comment-1073785</link>
    <description> &lt;p&gt;So, given a number of decimal places, you want to round to the nearest value.  So, 1.345 rounded to ONE place would be 1.3, but rounded to TWO places would be 1.35, right?&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;sub round {&lt;br /&gt;&amp;nbsp; my ($n,$pl) = (@_,0);&lt;br /&gt;&amp;nbsp; my $fact = 10**$pl;&lt;br /&gt;&amp;nbsp; return $n &amp;gt; 0 ?&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int($n * $fact + .5)/$fact :&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -int(-$n * $fact + .5)/$fact;&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;It expects you give it a non-negative integer for the value of decimal places to round it to.  Calling it as &lt;strong&gt;round($x)&lt;/strong&gt; will round it to an integer; calling it as &lt;strong&gt;round($x,$N)&lt;/strong&gt; will round it to &lt;strong&gt;$N&lt;/strong&gt; decimal places.&lt;/p&gt;
 </description>
     <pubDate>Thu, 09 Nov 2000 12:53:07 +0000</pubDate>
 <dc:creator>japhy</dc:creator>
 <guid isPermaLink="false">comment 1073785 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/formating-integer-values#comment-1073782</link>
    <description> &lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;$x = 2.67653;&lt;br /&gt;$x1 = int($x * 10 + 0.5)/10;&lt;br /&gt;$x2 = int($x * 100 + 0.5)/100;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;Untested, but should work.&lt;/p&gt;
 </description>
     <pubDate>Thu, 09 Nov 2000 11:08:42 +0000</pubDate>
 <dc:creator>anti</dc:creator>
 <guid isPermaLink="false">comment 1073782 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/formating-integer-values#comment-1073767</link>
    <description> &lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I mean, say I generate a number value of &quot;2.67653&quot; and want to round it &quot;2.7&quot; or &quot;2.68&quot; etc...&lt;/p&gt;
&lt;p&gt;Denise&lt;/p&gt;
 </description>
     <pubDate>Thu, 09 Nov 2000 02:45:18 +0000</pubDate>
 <dc:creator>Denise</dc:creator>
 <guid isPermaLink="false">comment 1073767 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/formating-integer-values#comment-1073759</link>
    <description> &lt;p&gt;First, define &quot;round&quot;.  Which of the following do you mean:&lt;/p&gt;
&lt;p&gt;&quot;floor&quot;: -1.1 gets rounded to -2, -1.9 gets rounded to -2, 1.1 gets rounded to 1, 1.9 gets rounded to 1&lt;/p&gt;
&lt;p&gt;&quot;ceil&quot;: -1.1 gets rounded to -1, -1.9 gets rounded to -1, 1.1 gets rounded to 2, 1.9 gets rounded to 2&lt;/p&gt;
&lt;p&gt;&quot;int&quot;: -1.1 gets rounded to -1, -1.9 gets rounded to -1, 1.1 gets rounded to 1, 1.9 gets rounded to 1&lt;/p&gt;
&lt;p&gt;&quot;nearest&quot;: -1.1 gets rounded to -1, -1.9 gets rounded to -2, 1.1 gets rounded to 1, 1.9 gets rounded to 2&lt;/p&gt;
&lt;p&gt;When you&#039;ve told me what you mean, I can offer some specific help and code.&lt;/p&gt;
 </description>
     <pubDate>Thu, 09 Nov 2000 01:42:26 +0000</pubDate>
 <dc:creator>japhy</dc:creator>
 <guid isPermaLink="false">comment 1073759 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
