guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] New division operators, and optimization for fractions


From: Andy Wingo
Subject: Re: [PATCH] New division operators, and optimization for fractions
Date: Sat, 12 Feb 2011 12:55:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

On Fri 11 Feb 2011 00:42, Mark H Weaver <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]