mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
* Add table showing supported inputs and expected outputs.
* Add see also to printf() / sprintf(). git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@279425 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
1ac3232850
commit
d14ed0797f
1 changed files with 136 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<refentry xml:id="function.decbin" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>decbin</refname>
|
||||
|
@ -13,8 +13,7 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
Returns a string containing a binary representation of the given
|
||||
<parameter>number</parameter> argument. The largest number that can be converted is
|
||||
4294967295 in decimal resulting to a string of 32 1's.
|
||||
<parameter>number</parameter> argument.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
|
@ -27,6 +26,135 @@
|
|||
<para>
|
||||
Decimal value to convert
|
||||
</para>
|
||||
|
||||
<table>
|
||||
<title>Range of inputs on 32-bit machines</title>
|
||||
<tgroup cols="3">
|
||||
<colspec colname="c1" />
|
||||
<colspec colname="c2" />
|
||||
<colspec colname="c3" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>positive <parameter>number</parameter></entry>
|
||||
<entry>negative <parameter>number</parameter></entry>
|
||||
<entry>return value</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>0</entry>
|
||||
<entry></entry>
|
||||
<entry>0</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry></entry>
|
||||
<entry>1</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>2</entry>
|
||||
<entry></entry>
|
||||
<entry>10</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry namest="c1" nameend="c3">... normal progression ...</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>2147483646</entry>
|
||||
<entry></entry>
|
||||
<entry>1111111111111111111111111111110</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>2147483647 (largest signed integer)</entry>
|
||||
<entry></entry>
|
||||
<entry>1111111111111111111111111111111 (31 1's)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>2147483648</entry>
|
||||
<entry>-2147483648</entry>
|
||||
<entry>10000000000000000000000000000000</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry namest="c1" nameend="c3">... normal progression ...</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>4294967294</entry>
|
||||
<entry>-2</entry>
|
||||
<entry>11111111111111111111111111111110</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>4294967295 (largest unsigned integer)</entry>
|
||||
<entry>-1</entry>
|
||||
<entry>11111111111111111111111111111111 (32 1's)</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<title>Range of inputs on 64-bit machines</title>
|
||||
<tgroup cols="3">
|
||||
<colspec colname="c1" />
|
||||
<colspec colname="c2" />
|
||||
<colspec colname="c3" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>positive <parameter>number</parameter></entry>
|
||||
<entry>negative <parameter>number</parameter></entry>
|
||||
<entry>return value</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>0</entry>
|
||||
<entry></entry>
|
||||
<entry>0</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry></entry>
|
||||
<entry>1</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>2</entry>
|
||||
<entry></entry>
|
||||
<entry>10</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry namest="c1" nameend="c3">... normal progression ...</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>9223372036854775806</entry>
|
||||
<entry></entry>
|
||||
<entry>111111111111111111111111111111111111111111111111111111111111110</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>9223372036854775807 (largest signed integer)</entry>
|
||||
<entry></entry>
|
||||
<entry>111111111111111111111111111111111111111111111111111111111111111 (31 1's)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>-9223372036854775808</entry>
|
||||
<entry>1000000000000000000000000000000000000000000000000000000000000000</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry namest="c1" nameend="c3">... normal progression ...</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>-2</entry>
|
||||
<entry>1111111111111111111111111111111111111111111111111111111111111110</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>-1</entry>
|
||||
<entry>1111111111111111111111111111111111111111111111111111111111111111 (64 1's)</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
@ -69,6 +197,11 @@ echo decbin(26);
|
|||
<member><function>decoct</function></member>
|
||||
<member><function>dechex</function></member>
|
||||
<member><function>base_convert</function></member>
|
||||
<member>
|
||||
<function>printf</function> or <function>sprintf</function>
|
||||
using <literal>%b</literal>, <literal>%032b</literal> or
|
||||
<literal>%064b</literal> as the format
|
||||
</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
Loading…
Reference in a new issue