"The set of mpq functions is quite small." Is this by design?
Torbjörn Granlund
tg at gmplib.org
Sun Aug 19 12:04:50 UTC 2018
"Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:
A note about naming conventions: there are currently two functions with
names matching mpq_*_ui: mpq_set_ui, and mpq_cmp_ui. They both take
TWO ui arguments, representing a fraction with both a small numerator
and a small denominator.
If we mean adding mpq_{add,sub,mul,div}_ui, for a _single_ ui argument,
well, why not? It's 80 lines of code... plus some more for testing...
Perhaps the _ui for a ulong tuple was poor design, but now that that
choice was made, how about having mpq_add_ui take a ui tuple too?
Passing 1 for the denominator isn't too hard, and the added overhead
will be minimal (the case t/1 could be singled out in the
implementation).
--
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-discuss
mailing list