mpz_ndiv_qr wanted

Marco Bodrato bodrato at mail.dm.unipi.it
Thu Sep 24 05:30:47 UTC 2015


Ciao Paul,

We (my fault) answered to one another privately...

Il Mar, 22 Settembre 2015 8:48 am, paul zimmermann ha scritto:
>> Date: Mon, 21 Sep 2015 23:09:35 +0200
>> From: "Marco Bodrato" <bodrato at mail.dm.unipi.it>
>> Il Ven, 18 Settembre 2015 8:04 pm, paul zimmermann ha scritto:
>> > an integer quotient and remainder with rounding to nearest, I believe
>> > this could be a nice addition to GMP, and useful to other users too.
>>
>> Do you think there is something that the library can do and the users
>> can not?
>
> no: I believe several users might find such a function a useful addition.

Let's ask...

>> >  -- Function: void mpz_ndiv_qr (mpz_t Q, mpz_t R, const mpz_t N, const
>> > mpz_t D)
>>
>> > and of course the corresponding mpz_ndiv_q and mpz_ndiv_r functions.
>>
>> And of course mpz_ndiv_{_q,_r,_qr,}_ui, but the existing div_ui
>> functions return unsigned long, the new ones should return signed long...
>> Plus the _2exp variants...
>>
>> > (The tie-breaking rule for the case |R| = D/2 comes from IEEE 754.)
>>
>> There are plenty of tie-breaking rules
>> https://en.wikipedia.org/wiki/Rounding#Tie-breaking
>
> in my application, any tie-breaking rule would be fine, as long as it is
> documented.
>
> Do other GMP users out there need such a function?

Any others?

Regards,
m

-- 
http://bodrato.it/



More information about the gmp-devel mailing list