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] New division operators, and optimization for fractions
Date: Sat, 12 Feb 2011 12:55:18 +0100	[thread overview]
Message-ID: <m3hbc9bh7d.fsf@unquote.localdomain> (raw)
In-Reply-To: <87sjvvv4md.fsf@yeeloong.netris.org> (Mark H. Weaver's message of "Thu, 10 Feb 2011 18:42:18 -0500")

On Fri 11 Feb 2011 00:42, Mark H Weaver <mhw@netris.org> writes:

> Here are three more patches.  The first adds fast implementations of the
> remaining number-theoretic division operators as described in Taylor
> Campbell's proposal: floor/, ceiling/, truncate/, round/, as well as the
> single-valued variants.  The third patch optimizes the case where both
> arguments are exact and at least one is a fraction.

Cool!  It's a lot of code, but it does appear useful and tested, so I'm
inclined to merge it.

Regarding multiple values: instead of unpacking values objects (ugh),
can you instead make versions of _divide that return two values
directly, as output arguments?

You would then have to define wrappers that pack the return values into
a values object.  Those wrappers could be static, if possible, so we
don't publicly expose more interfaces that return a SCM_VALUES object.

It would in the future be possible to do something much more efficient,
if we extended gsubrs to allow for multiple return values, so that
primitives could return multiple values without consing.  But that's a
thought for later.

Also, does it make sense to implement quotient and remainder directly in
terms of divide?  I suspect it might.

What do you think?

Andy
-- 
http://wingolog.org/



  reply	other threads:[~2011-02-12 11:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10 23:42 [PATCH] New division operators, and optimization for fractions Mark H Weaver
2011-02-12 11:55 ` Andy Wingo [this message]
2011-02-14 13:56   ` Ken Raeburn
2011-02-14 18:17     ` Mark H Weaver
2011-02-15 10:38 ` Ludovic Courtès
2011-02-15 11:43   ` Mark H Weaver
2011-02-15 14:49     ` Ludovic Courtès
     [not found] <860989.4731.qm@web114104.mail.gq1.yahoo.com>
2011-02-12 20:19 ` Andy Wingo
2011-02-13 14:55   ` Mark H Weaver
2011-02-14 19:44     ` Andy Wingo
     [not found] <595618.30923.qm@web114107.mail.gq1.yahoo.com>
2011-02-12 21:54 ` Andy Wingo
2011-02-12 22:38   ` Mark 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=m3hbc9bh7d.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).