tag:blogger.com,1999:blog-6537549.post1004156902553692834..comments2014-05-14T12:46:07.806+01:00Comments on Tiago Andrade e Silva: .Net Math 0.7 + 0.2 = 0.89999999999999991Unknownnoreply@blogger.comBlogger4125tag:blogger.com,1999:blog-6537549.post-85416375740961317772007-12-19T17:01:00.000+00:002007-12-19T17:01:00.000+00:00Another blog about this issuehttp://scrappydog.com...Another blog about this issue<BR/>http://scrappydog.com/user/CreateUser.aspx?ReturnUrl=/blogs/blog/archive/2006/08/04/9996.aspxAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6537549.post-27034372107243195212007-12-18T15:12:00.000+00:002007-12-18T15:12:00.000+00:00Hi!You're right. Here is a simpler version:using S...Hi!<BR/>You're right. Here is a simpler version:<BR/>using System;<BR/><BR/>using System.Text;<BR/><BR/>using System.Globalization;<BR/><BR/>namespace ConsoleApplication1<BR/><BR/>{<BR/><BR/>class Program<BR/><BR/>{<BR/><BR/>static void Main(string[] args)<BR/><BR/>{<BR/><BR/>//The error happens with any of these arrays:<BR/>//double[] tokensd = {0.2, 0.25, 0.25, 0.2, 0.1};<BR/>//double[] tokensd = { 0.1, 0.1, 0.1, 0.2, 0.1,0.3,0.1 };<BR/>double[] tokensd = { 0.65, 0.15, 0.05, 0.05, 0.1 };<BR/><BR/>double TotalProbs = 0; //Sum the <BR/>double prob = 0;<BR/><BR/>for (int i = 0; i < tokensd.Length; i++)<BR/>{<BR/>TotalProbs += tokensd[i];<BR/>}<BR/>if (TotalProbs !=1)<BR/>{<BR/>throw new Exception("This should not happen!!!");<BR/>}<BR/>}<BR/>}<BR/>}Tiago Andrade e Silvahttps://www.blogger.com/profile/05669059598426941843noreply@blogger.comtag:blogger.com,1999:blog-6537549.post-14441771452420401932007-12-18T15:06:00.000+00:002007-12-18T15:06:00.000+00:00Hi Tas, you probably forgot some part of your code...Hi Tas, you probably forgot some part of your code... see the for loop.Sklivvzhttps://www.blogger.com/profile/04634595770973072948noreply@blogger.comtag:blogger.com,1999:blog-6537549.post-10029717387421853222007-12-17T23:34:00.000+00:002007-12-17T23:34:00.000+00:00Also posted in MSDN Forumshttp://forums.microsoft....Also posted in MSDN Forums<BR/>http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2567268&SiteID=1&mode=1Tiago Andrade e Silvahttps://www.blogger.com/profile/05669059598426941843noreply@blogger.com