mpq_cmp_z

Torbjörn Granlund tg at gmplib.org
Fri Sep 4 06:45:58 UTC 2015


"Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:

  I know, but when you write conditions like (a>b) you don't just have to
  test the two cases (a>b) and (a<b), you may need to be sure that the
  corner-cases (eg, a==b) are tested.
  
Yes, for such things coverage tools give a false sense of security.

Perhaps we should add a few more macros to GMP...

#if DEBUG_COVERAGE
#define LTVAL(val,a,b) \
  if ((a) < (b))
    (val) = 1;
  else {
    (val) = 0;
    if ((a) == (b))
      dummycall();
    }
#endif

:-)

If we compile GMP with a C++ compiler, we could achieve the same with
operator overloading.

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list