[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] First batch of numerics changes
From: |
Andy Wingo |
Subject: |
Re: [PATCH] First batch of numerics changes |
Date: |
Fri, 28 Jan 2011 12:41:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hi Mark,
On Wed 26 Jan 2011 17:32, Mark H Weaver <address@hidden> writes:
I don't understand this change:
> From c42d03050ea0f96556e73e405e530b78bb85aba7 Mon Sep 17 00:00:00 2001
> From: Mark H Weaver <address@hidden>
> Date: Wed, 26 Jan 2011 02:56:20 -0500
> Subject: [PATCH] Add case for fractions with differing SCM_CELL_TYPE to
> scm_equal_p
>
> * libguile/eq.c (scm_equal_p): Add a special case for fractions with
> differing SCM_CELL_TYPE, which might nonetheless be considered equal
> (due to the use of 0x10000 as a flag), to scm_equal_p. This code
> was already present in scm_eqv_p.
>
> (scm_eqv_p): Move comment (regarding special case for fractions)
> next to the corresponding code.
> ---
> libguile/eq.c | 19 +++++++++++++------
> 1 files changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/libguile/eq.c b/libguile/eq.c
> index 7502559..dc548b8 100644
> @@ -322,6 +322,13 @@ scm_equal_p (SCM x, SCM y)
> && SCM_COMPLEX_IMAG (x) == 0.0);
> }
>
> + /* fractions use 0x10000 as a flag (at the suggestion of Marius
> Vollmer),
> + but this checks the entire type word, so fractions may be accidentally
> + flagged here as unequal. Perhaps I should use the 4th double_cell
> word?
> + */
> + if (SCM_FRACTIONP (x) && SCM_FRACTIONP (y))
> + return scm_i_fraction_equalp (x, y);
> +
> /* Vectors can be equal to one-dimensional arrays.
> */
> if (scm_is_array (x) && scm_is_array (y))
In what case would two fractions ever not have the same SCM_CELL_TYPE ?
I don't understand this discussion of flags. AFAICS fractions have their
own tc16, and no flags are ever set.
Furthermore I would think that the `if (SCM_NUMP (x))' block in
scm_eqv_p could use a switch statement instead of a bunch of ifs.
Regards,
Andy
--
http://wingolog.org/
- Re: [PATCH] First batch of numerics changes, (continued)
- Re: [PATCH] First batch of numerics changes, Andy Wingo, 2011/01/29
- Re: [PATCH] First batch of numerics changes, Mark H Weaver, 2011/01/29
- Re: [PATCH] First batch of numerics changes, Mark H Weaver, 2011/01/29
- Commentary: R6RS div0-and-mod0 vs Taylor's `round/', Mark H Weaver, 2011/01/30
- Re: [PATCH] First batch of numerics changes, Andy Wingo, 2011/01/30
- Re: [PATCH] First batch of numerics changes, Andy Wingo, 2011/01/30
- Re: [PATCH] First batch of numerics changes, Mark H Weaver, 2011/01/30
Re: [PATCH] First batch of numerics changes,
Andy Wingo <=