Hello:<br><br><div><span class="gmail_quote">On 9/29/07, <b class="gmail_sendername">Andrew Farmer</b> &lt;<a href="mailto:andfarm@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">andfarm@gmail.com 
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
<br>If your bank is doing financial calculations using Javascript in a<br>standard web browser, you have bigger things to worry about than<br>roundoff errors.</blockquote><div><br></div>&nbsp;Ok let&#39;s explain this with more details because I realize that you got something else (and might be the case of others). I was not refering to banks performing all of the calculations on the browser.&nbsp;That&nbsp;would&nbsp;be&nbsp;insane because users would be manipulating that for sure changing a couple of web pages.  A bank would not last  a single day on the internet in such case. I was commenting you about some calculations done in your browser&nbsp;so you don&#39;t have to make them in your head, your operating system calculator or a pocket calculator. Taxes and other kind of   financial calculations for example.&nbsp;Hey&nbsp;I&nbsp;could&nbsp;add&nbsp;a&nbsp;financial&nbsp;calculator&nbsp;on&nbsp;one side&nbsp;of&nbsp;a&nbsp;page&nbsp;so&nbsp;you&nbsp;don&#39;t&nbsp;have&nbsp;to&nbsp;pick&nbsp;one. I don&#39;t know&nbsp;wich&nbsp;calculus&nbsp;you&nbsp;could&nbsp;do I&#39;m not a banker (not yet. I tell you by then).&nbsp;The&nbsp;browser&nbsp;can&nbsp;do&nbsp;that&nbsp;kind of things better than you.&nbsp;I&nbsp;don&#39;t&nbsp;know&nbsp;an&nbsp;exact example&nbsp;but&nbsp;it&nbsp;could&nbsp;be&nbsp;the&nbsp;case.&nbsp;Remeber&nbsp;there&nbsp;are&nbsp;a&nbsp;zillion&nbsp;websites&nbsp;out&nbsp;there.&nbsp;All the bank needs to be&nbsp;sure is      that all of the movements you do   does not exceeds your balance. If you&nbsp;(or your browser) intentionally&nbsp;or&nbsp;not performs the&nbsp;calculation wrong...&nbsp;Well...&nbsp;that&nbsp;is&nbsp;your&nbsp;problem.&nbsp;You&nbsp;won&#39;t&nbsp;steal&nbsp;money&nbsp;with&nbsp;that to the bank. And that kind of things  are very likely to be putted into the browser more and more with AJAX, SilverLight and all of them just to prevent mistakes in the first place. Is the trend.&nbsp;So&nbsp;a&nbsp;rounding bug&nbsp;in&nbsp;javascript&nbsp;(in such case)&nbsp;could&nbsp;be&nbsp;really&nbsp;serious.  
<br><br>&nbsp;Also notice that&nbsp;if&nbsp;there&nbsp;is&nbsp;really&nbsp;a&nbsp;problem&nbsp;in&nbsp;FF&nbsp;javascript&nbsp;engine&nbsp;it&nbsp;goes&nbsp;beyond&nbsp;the&nbsp;browser.&nbsp;You could run Tamarin, Spidermonkey or Rhino on the server side       and perform some processing&nbsp;there with javascript.
<br> <br><a href="http://developer.mozilla.org/en/docs/About_JavaScript">http://developer.mozilla.org/en/docs/About_JavaScript</a><br><br>&quot;Another common application for JavaScript is as a (web) server side scripting language. A JavaScript web server would expose host objects representing a HTTP request and response objects, which could then be manipulated by a JavaScript program to dynamically generate web pages.&quot;
<br><br><br>I based my previous comments on  comments from some other persons but not on my tests. I tried this code and is giving me the same result&nbsp;(5.1000000000000005)&nbsp;in&nbsp;IE&nbsp;6,&nbsp;FF&nbsp;<a href="http://2.0.0.7" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
2.0.0.7</a>&nbsp;and&nbsp;Opera&nbsp; 9.23:<br><br>&lt;html&gt;<br>&lt;script type=&quot;text/javascript&quot;&gt;<br>a=5.2;<br>b=0.1;<br>alert(a-b);<br>&lt;/script&gt;<br>&lt;/html&gt;<br><br>This one is giving me the same numbers too in every browser:
<br><br> &lt;html&gt;<br>&lt;a href=&quot;javascript:alert(5.2-0.1)&quot;&gt;arrf&lt;/a&gt;<br>&lt;/html&gt;<br><br><br>&nbsp;So seems to me that IE is actually performing those calculations&nbsp;with&nbsp;higher&nbsp;precision&nbsp;only&nbsp;when&nbsp;used&nbsp;as&nbsp;a&nbsp;calculator&nbsp;(directly in the address box)&nbsp;but&nbsp;not&nbsp;in&nbsp;javascript&nbsp;code (fortunately).&nbsp;However&nbsp;let&nbsp;me&nbsp;know&nbsp;if&nbsp;you&nbsp;find&nbsp;something.&nbsp;I&#39;m&nbsp;interested and would like to be aware of it.  
<br><br>&nbsp;As a side comment I wanted to tell you that what is out there&nbsp;on&nbsp;the&nbsp;internet is not a standart. Is what IE dictates.  IE rules the internet whether you like or not. It comes from a big one&nbsp;and&nbsp;also comes preinstalled.  That&#39;s why  it holds a&nbsp;big&nbsp;share of the market. It imperates and has a lot of pressure on the content published on the internet.&nbsp;As&nbsp;IE&nbsp;adapts&nbsp;to&nbsp;the&nbsp;web,&nbsp;the&nbsp;web&nbsp;also&nbsp;adapts&nbsp;to&nbsp;IE. 
<br><br></div>As another side comment about the FP math. Well&nbsp;don&#39;t&nbsp;worry&nbsp;I&nbsp;already&nbsp;did that some time ago.&nbsp;While&nbsp;I&#39;m&nbsp;not&nbsp;the&nbsp;expert&nbsp;in&nbsp;numeric&nbsp;math&nbsp;that&nbsp;was&nbsp;the&nbsp;first&nbsp;part&nbsp;of&nbsp;the&nbsp;first course of numeric&nbsp;math&nbsp;on&nbsp;my second&nbsp;year.&nbsp;As&nbsp;a&nbsp;curiority&nbsp;and&nbsp;also&nbsp;a&nbsp;very&nbsp;usual&nbsp;mistake&nbsp;is&nbsp;that&nbsp;in&nbsp;FP&nbsp;math&nbsp;a&nbsp;+ b&nbsp;+ c&nbsp;is&nbsp;not&nbsp;always&nbsp;equal&nbsp;to&nbsp;a + c + b.&nbsp;You&nbsp;must&nbsp;sort&nbsp;the&nbsp;numbers&nbsp;before&nbsp;doing&nbsp;that&nbsp;and do the calculus from lower to higher if&nbsp;you&nbsp;want&nbsp;the most accurate results.&nbsp;Yes&nbsp;FP&nbsp;math&nbsp;is&nbsp;tricky&nbsp;sometimes and a lot of care must be taken with it since is not real math but approximations.&nbsp;For example sometimes you need to make transformations to equations or use Taylor. It&nbsp;might&nbsp;look&nbsp;boring&nbsp;at&nbsp;first&nbsp;sight&nbsp;but&nbsp;when&nbsp;you&nbsp;look&nbsp;closer&nbsp;you&nbsp;realize&nbsp;that&nbsp;is&nbsp;very&nbsp;important and catches your eye. 
<br><br>Regards<br>Waldo Alvarez<br>