[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCHES] Numeric improvements
From: |
Ludovic Courtès |
Subject: |
Re: [PATCHES] Numeric improvements |
Date: |
Thu, 07 Mar 2013 20:02:27 +0100 |
User-agent: |
Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) |
Mark H Weaver <address@hidden> skribis:
>> What was the rationale for ‘round-ash’?
>
> Well, we need it internally to efficiently convert large integers to
> floating-point with proper rounding (see the call to
> 'round_right_shift_exact_integer' in patch 5). Given that, it seemed
> reasonable to export it to the user, since it's not possible to do that
> job efficiently with our current primitives. However, I don't feel
> strongly about it.
OK, the rationale makes sense to me.
>> It seems to address to do two things differently from ‘ash’: it’s more
>> efficient, and it rounds when right-shifting. The “more efficient” bit
>> is an implementation detail that should also benefit to ‘ash’ (as a user
>> I don’t want to have to choose between efficient and non-rounding.)
>
> No, 'round-ash' is not more efficient than 'ash'. It's more efficient
> than the equivalent (round (* n (expt 2 count))).
I see. I misunderstood the documentation’s reference to efficiency.
Thanks,
Ludo’.