Re: [q-lang-users] [Chicken-users] Re: IEEE float arithmetic
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2006-06-21 04:46:27
|
John Cowan wrote: > Abdulaziz Ghuloum scripsit: > >>Out of curiosity, why not simply do "f==1.0/0.0 || f==-1.0/0.0" to test >>if f is +inf.0/-inf.0? > > Umm. Too obvious, I guess. I started working these out in > Chicken, where dividing by zero throws an exception, so I > wanted some other method. But in C, of course, there's no > such issue. But you want the code at least not to do any harm on systems with _no_ IEEE floats. I'm not sure, but couldn't dividing by 0.0 on such systems kill your program with SIGFPE? Another point is that division is a much more costly operation than adding and subtracting. BTW, should I cc the Chicken list in this thread? -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |