On Wed, 17 Jan 2018, Vincent Lefevre wrote:

On 2018-01-17 18:06:49 +0100, Marc Glisse wrote:
On Wed, 17 Jan 2018, Vincent Lefevre wrote:

On 2018-01-17 17:23:02 +0100, Marc Glisse wrote:
Indeed, it doesn't make sense to have both the assertion and
COUNT_LEADING_ZEROS_0. Would it work to remove the assertion instead?

Yes, this works too (assuming that 0 will always be converted to +0).

You know those details better than me, is that a dangerous assumption to
make? Even when restricted to the architectures / compilers that may use
this code? I was expecting it to be rather safe, but if you think it isn't,
then I'd rather go with your original patch.

I know that both icc -O2 and tcc had issues with signed zeros in the
past. But I haven't done any test for several years.

I expect most compilers still have issues with signed zeros in some complicated cases, I just expect that it is very unlikely that conversion from integer 0 would suddenly generate -0.0. The case I could imagine is:

int i = ...;
int n = -i;
double d = n;

and the compiler would badly "optimize" that to

double tmp = i;
double d = -tmp;

Well, let's see if someone else wants to comment. I am currently in favor of removing ASSERT.

--
Marc Glisse
_______________________________________________
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs

Reply via email to