Planet MySQL Planet MySQL: Meta Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 1

Displaying posts with tag: mysqltest (reset)

[edit] MySQL bit_count() function does what it is supposed to do
+0 Vote Up -5Vote Down

From the MySQL manual:

Returns the number of bits that are set in the argument N.


I thought that meant that it returned the number of bits which needed to be set in order to store the value. To store 2^32 you need 33 bits of storage, with only one bit /set/. I expected 33 instead of 1.

#tested on 5.0.45 and 5.1.32-community
mysql> select i, pow(2,i), bit_count(pow(2,i)) from pow2;
| i  | pow(2,i)   | bit_count(pow(2,i)) |
|  1 |          2 |                   1 |
|  2 |          4 |                   1 |
|  3 | …

  [Read more...]
Showing entries 1 to 1

Planet MySQL © 1995, 2016, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.