I see the wrong result on my machine, just like
Fred. Jürgen, the problem seems to be in this code:
// if ⎕CT != 0 and B ÷ A is close to an integer within
⎕CT then return 0.
//
// Note: In that case, the integer to which A ÷ B is
close is either
// floor(A ÷ B) or ceil(A ÷ B).
//
const APL_Float qct = Workspace::get_CT();
if (qct != 0)
{
const APL_Complex quot = cval() / a;
const APL_Float qfr = floor(quot.real());
const APL_Float qfi = floor(quot.imag());
const APL_Float qcr = ceil(quot.real());
const APL_Float qci = ceil(quot.imag());
if (quot.real() > (qcr - qct) &&
quot.imag() > (qci - qct))
return IntCell::z0(Z); // quot is close to
its ceiling
if (quot.real() < (qfr - qct) &&
quot.imag() < (qfi - qct))
return IntCell::z0(Z); // quot is close to
its floor
}
In this case quot is:
(gdb) p quot
$14 = {_M_value = 6.9999999999999991 +
-1.9999999999999998 * I}
... which is close to the Gaussian integer 7J¯2. But you
only check for it being close to 7J¯1 and 6J¯2, both of which
tests fail.
As for why Fred and I see this problem and you don't: I
guess on your machine the _expression_ cval() / a probably
returns an exact (Gaussian) integer result? If so, I guess
it's down to some small change in the compiler version, or
glibc, or whatever provides the implementation of
std::complex<double>::operator/.
Jay.