Questions tagged [iec10967]

ISO/IEC 10967, language-independent arithmetic (LIA), is a series of standards on computer arithmetic. It is compatible with ISO/IEC/IEEE 60559:2011, better known as IEEE 754-2008, and indeed much of the specifications are for IEEE 754 special values (though such values are not required by LIA itself, unless the parameter iec559 is true). Via Wikipedia

iec10967
Filter by
Sorted by
Tagged with
1013 votes
66 answers
648k views

Count the number of set bits in a 32-bit integer

8 bits representing the number 7 look like this: 00000111 Three bits are set. What are the algorithms to determine the number of set bits in a 32-bit integer?
361 votes
12 answers
75k views

What is the rationale for all comparisons returning false for IEEE754 NaN values?

Why do comparisons of NaN values behave differently from all other values? That is, all comparisons with the operators ==, <=, >=, <, > where one or both values is NaN returns false, contrary to ...
starblue's user avatar
  • 56k
3 votes
3 answers
581 views

Long integer is transformed when inserted in shorter column, not truncated. Why? What is the formula?

I have a column of type integer with length 10: `some_number` int(10) unsigned NOT NULL Into this column I insert a number that is too long: $some_number = 715988985123857; $query = "INSERT INTO ...
user avatar
3 votes
2 answers
1k views

Why did IEEE-754 decide NaN != NaN despite being illogical?

This is a follow up question to What is the rationale for all comparisons returning false for IEEE754 NaN values? (I think this is better as another question than a comment). It has a very good answer ...
SkySpiral7's user avatar
2 votes
3 answers
555 views

Bit tricks to find the first position where the number of 0s equals the number of 1s

Suppose I have a 32 or 64 bit unsigned integer. What is the fastest way to find the index i of the leftmost bit such that the number of 0s in the leftmost i bits equals the number of 1s in the ...
Steven's user avatar
  • 209
1 vote
1 answer
861 views

multiplication limit of integers for GMP library

I was attempting to multiply two very large mpz_ts together, each of 2^(10*2^22) bits, using the mpz_mul function in the GMP library. There was no segmentation fault, and the multiplication managed ...
meta_warrior's user avatar
-2 votes
2 answers
1k views

How do I make an integer 'bigger'? [closed]

I am a C# beginner and I am working on a calculator in Windows Forms. I've encountered a problem in which I get one of those debug blurbs after 10 or more digits are inputed into the interface. It ...
user3587709's user avatar