This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: IS_INF bug?


On Tue, May 09, 2000 at 01:19:29PM +0200, Han-Wen Nienhuys wrote:
> 
> I think the naming of the following macro should be changed to
> NONZERO_IS_INF, or something alike. The name is misleading.
> 
> 
> 	/* IS_INF tests its floating point number for infiniteness
> 	 */
> 	#ifndef IS_INF
> 	#define IS_INF(x) ((x) == (x) / 2)
> 	#endif
> 
> 
> -- 
> 
> Han-Wen Nienhuys, hanwen@cs.uu.nl ** GNU LilyPond - The Music Typesetter 
>       http://www.cs.uu.nl/people/hanwen/lilypond/index.html 

Hmm, what do you mean by NONZERO_IS_INF?  If it's zero it is NOT
infinity. And vice versa.

If you meant that the check will work for zero, it seems that you are
right. A (mathematically) corect test for infinity would be 
((x) == (x) + 1) but I don't know if this makes sense for the macro.

-- 
Ivan Toshkov

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]