1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

* eq.c (scm_eqv_p, scm_equal_p): Removed uses of

SCM_SLOPPY_INEXACTP, SCM_SLOPPY_REALP and SCM_SLOPPY_COMPLEXP.

	* eq.c (scm_eqv_p, scm_equal_p): Reordered comparisons from
	0.0==some_expression to some_expression==0.0.  The latter is
	better readable.  The former is preferred by some people, since it
	leads to a compiler error when confusing == with =.  However, when
	using gcc, a warning will be issued if in an if-statement an
	assigment appears.  Since many Guile developers are using gcc,
	such errors will not remain unnoticed anyway.  We can therefore
	focus on better readability.
This commit is contained in:
Dirk Herrmann 2003-09-06 08:50:26 +00:00
parent 7e3b25bf51
commit 6b412e9171
2 changed files with 27 additions and 13 deletions

View file

@ -1,3 +1,17 @@
2003-09-06 Dirk Herrmann <D.Herrmann@tu-bs.de>
* eq.c (scm_eqv_p, scm_equal_p): Removed uses of
SCM_SLOPPY_INEXACTP, SCM_SLOPPY_REALP and SCM_SLOPPY_COMPLEXP.
* eq.c (scm_eqv_p, scm_equal_p): Reordered comparisons from
0.0==some_expression to some_expression==0.0. The latter is
better readable. The former is preferred by some people, since it
leads to a compiler error when confusing == with =. However, when
using gcc, a warning will be issued if in an if-statement an
assigment appears. Since many Guile developers are using gcc,
such errors will not remain unnoticed anyway. We can therefore
focus on better readability.
2003-09-04 Dirk Herrmann <D.Herrmann@tu-bs.de>
* tags.h: Added description of Guile's type system. Removed some

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003 Free Software Foundation, Inc.
/* Copyright (C) 1995,1996,1997,1998,2000,2001,2003 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -80,15 +80,15 @@ SCM_PRIMITIVE_GENERIC_1 (scm_eqv_p, "eqv?", scm_tc7_rpsubr,
if (SCM_CELL_TYPE (x) != SCM_CELL_TYPE (y))
{
/* treat mixes of real and complex types specially */
if (SCM_SLOPPY_INEXACTP (x))
if (SCM_INEXACTP (x))
{
if (SCM_SLOPPY_REALP (x))
return SCM_BOOL (SCM_SLOPPY_COMPLEXP (y)
if (SCM_REALP (x))
return SCM_BOOL (SCM_COMPLEXP (y)
&& real_eqv (SCM_REAL_VALUE (x),
SCM_COMPLEX_REAL (y))
&& 0.0 == SCM_COMPLEX_IMAG (y));
&& SCM_COMPLEX_IMAG (y) == 0.0);
else
return SCM_BOOL (SCM_SLOPPY_REALP (y)
return SCM_BOOL (SCM_REALP (y)
&& real_eqv (SCM_COMPLEX_REAL (x),
SCM_REAL_VALUE (y))
&& SCM_COMPLEX_IMAG (x) == 0.0);
@ -98,8 +98,8 @@ SCM_PRIMITIVE_GENERIC_1 (scm_eqv_p, "eqv?", scm_tc7_rpsubr,
if (SCM_NUMP (x))
{
if (SCM_BIGP (x)) {
return SCM_BOOL (0 == scm_i_bigcmp (x, y));
} else if (SCM_SLOPPY_REALP (x)) {
return SCM_BOOL (scm_i_bigcmp (x, y) == 0);
} else if (SCM_REALP (x)) {
return SCM_BOOL (real_eqv (SCM_REAL_VALUE (x), SCM_REAL_VALUE (y)));
} else { /* complex */
return SCM_BOOL (real_eqv (SCM_COMPLEX_REAL (x),
@ -149,14 +149,14 @@ SCM_PRIMITIVE_GENERIC_1 (scm_equal_p, "equal?", scm_tc7_rpsubr,
if (SCM_CELL_TYPE (x) != SCM_CELL_TYPE (y))
{
/* treat mixes of real and complex types specially */
if (SCM_SLOPPY_INEXACTP (x))
if (SCM_INEXACTP (x))
{
if (SCM_SLOPPY_REALP (x))
return SCM_BOOL (SCM_SLOPPY_COMPLEXP (y)
if (SCM_REALP (x))
return SCM_BOOL (SCM_COMPLEXP (y)
&& SCM_REAL_VALUE (x) == SCM_COMPLEX_REAL (y)
&& 0.0 == SCM_COMPLEX_IMAG (y));
&& SCM_COMPLEX_IMAG (y) == 0.0);
else
return SCM_BOOL (SCM_SLOPPY_REALP (y)
return SCM_BOOL (SCM_REALP (y)
&& SCM_COMPLEX_REAL (x) == SCM_REAL_VALUE (y)
&& SCM_COMPLEX_IMAG (x) == 0.0);
}