unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel@gnu.org
Subject: Re: [PATCH] First batch of numerics changes
Date: Fri, 28 Jan 2011 12:41:20 +0100	[thread overview]
Message-ID: <m34o8tfe73.fsf@unquote.localdomain> (raw)
In-Reply-To: <87lj2762xc.fsf@yeeloong.netris.org> (Mark H. Weaver's message of "Wed, 26 Jan 2011 11:32:47 -0500")

Hi Mark,

On Wed 26 Jan 2011 17:32, Mark H Weaver <mhw@netris.org> writes:

I don't understand this change:

> From c42d03050ea0f96556e73e405e530b78bb85aba7 Mon Sep 17 00:00:00 2001
> From: Mark H Weaver <mhw@netris.org>
> 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/



  parent reply	other threads:[~2011-01-28 11:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-26 16:32 [PATCH] First batch of numerics changes Mark H Weaver
2011-01-26 18:07 ` Mark H Weaver
2011-01-26 22:46 ` Mark H Weaver
2011-01-27 22:06   ` Mark H Weaver
2011-01-28 12:19     ` Andy Wingo
2011-01-29  0:05       ` Mark H Weaver
2011-01-29 11:29         ` Andy Wingo
2011-01-27 22:32   ` Mark H Weaver
2011-01-28 13:46   ` Andy Wingo
2011-01-28 14:44     ` Noah Lavine
2011-01-28 15:55       ` Andy Wingo
2011-01-29  8:20     ` Mark H Weaver
2011-01-29 17:42       ` Andy Wingo
2011-01-29 20:20         ` Mark H Weaver
2011-01-30 11:48           ` Andy Wingo
2011-01-29 17:50       ` Andy Wingo
2011-01-29 20:36         ` Mark H Weaver
2011-01-29 22:24         ` Mark H Weaver
2011-01-30  6:02           ` Commentary: R6RS div0-and-mod0 vs Taylor's `round/' Mark H Weaver
2011-01-30 11:50           ` [PATCH] First batch of numerics changes Andy Wingo
2011-01-30 12:12       ` Andy Wingo
2011-01-30 16:33         ` Mark H Weaver
2011-01-28 11:41 ` Andy Wingo [this message]
2011-01-28 23:36   ` Mark H Weaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m34o8tfe73.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).