bug-gmp
[Top][All Lists]
Advanced

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

C++ documentation of division and assignment.


From: Axel Simon
Subject: C++ documentation of division and assignment.
Date: Thu, 19 Aug 2004 14:54:18 +0100
User-agent: Mutt/1.4.1i

Hi,

two things:

1) The C++ mpq_class(integer, integer) constructor does not canonicalize.  
Canonicalization could be expected since the documentation does not say
explicitly that the constructor is an assignment (which would imply no
normalization). Hence it might be worthwhile mentioning that canonicalization
has to be done manually.

2) The / operator on mpz_class calls mpz_tdiv_q which is rounding towards
zero. This is couter-intuitive. On normal two-complement integers, truncating
the result means rounding towards -\infty. Hence an integer division on gmp
numbers is different from a normal int divison. I think this is a design flaw
for which it is too late to fix. At least the documentation should mention
that rounding towards zero happens.

Thanks for a nice library,
Axel.





reply via email to

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