Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!postnews.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 05 Apr 2012 05:48:47 -0500 Message-ID: <4F7D788E.45B9@mindspring.com> Date: Thu, 05 Apr 2012 06:48:46 -0400 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.lang.c Subject: Re: Odd benchmark behavior References: <9talg3F84gU1@mid.individual.net> <4f70351c$0$1385$4fafbaef@reader2.news.tin.it> <4f703bfa$0$1386$4fafbaef@reader2.news.tin.it> <4f71688a$0$1383$4fafbaef@reader2.news.tin.it> <4f716921$0$1383$4fafbaef@reader2.news.tin.it> <4F727C20.5A49@mindspring.com> <4f7d7076$0$1379$4fafbaef@reader2.news.tin.it> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 45 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.216.205 X-Trace: sv3-P3TTd2QxXEEQiIHxktno5a90WJBR48LlO8vsCLm691wmi+2jsttflfhD+1hpN0DqXBZbysOdtqRK9IE!ACpSFima7Ra+eCtWAo9uUmqusgiwGBUFuqaLpg7Yx8iaENNHl0KdKk4vZ1JhT4/aTyYdcj5vN5dC!9AcXyzC5WdU= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2262 Xref: csiph.com comp.lang.c:19354 io_x wrote: > > "pete" ha scritto nel messaggio > news:4F727C20.5A49@mindspring.com... > > io_x wrote: > >> > >> "io_x" ha scritto nel messaggio > >> news:4f71688a$0$1383$4fafbaef@reader2.news.tin.it... > >> > >> there is someone that know if (unsigned) sqrt(9.0) can be > >> follow the C standard the unsigned 2??? > >> Thank you > > > > You could do it this way instead: > > > > la: > > v = p; > > for (i = ((1 == v) + v) / 2; v > i; i = (p / v + v) / 2) { > > v = i; > > } > > the above is wrong, for example > if p==0 than v=0, i=0/2=0; 0>0 is false; > so i=0/0 and here seg fault After 0>0 is false, the loop stops and then there is no i=0/0. > if 0.0 it depend how they round float number This is the code that you wrote: #define u32 uint32_t u32 i, p, cnt, v; There are no float numbers in that code. -- pete