mirror of
https://github.com/php/doc-en.git
synced 2026-03-23 23:32:18 +01:00
Remove references to "double" and use float instead (#1848)
This commit is contained in:
committed by
GitHub
parent
a109454179
commit
19e8122137
@@ -561,7 +561,7 @@ $f = function ($param) use ($param) {};
|
||||
<title>JSON encoding and decoding</title>
|
||||
<para>
|
||||
The <parameter>serialize_precision</parameter> ini setting now controls the
|
||||
serialization precision when encoding doubles.
|
||||
serialization precision when encoding <type>float</type>s.
|
||||
</para>
|
||||
<para>
|
||||
Decoding an empty key now results in an empty property name, rather than
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
<listitem>
|
||||
<simpara>
|
||||
<type>float</type> (floating-point number, aka <type>double</type>)
|
||||
<type>float</type> (floating-point number)
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
@@ -93,11 +93,6 @@
|
||||
</listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
<simpara>
|
||||
Some references to the type "double" may remain in the manual. Consider
|
||||
double the same as float; the two names exist only for historic reasons.
|
||||
</simpara>
|
||||
|
||||
<simpara>
|
||||
The type of a variable is not usually set by the programmer; rather, it is
|
||||
|
||||
@@ -148,7 +148,7 @@ var_dump($unset_str);
|
||||
$unset_int += 25; // 0 + 25 => 25
|
||||
var_dump($unset_int);
|
||||
|
||||
// Float/double usage; outputs 'float(1.25)'
|
||||
// Float usage; outputs 'float(1.25)'
|
||||
$unset_float += 1.25;
|
||||
var_dump($unset_float);
|
||||
|
||||
|
||||
@@ -155,20 +155,32 @@ var_dump(date_parse("2006-12-12 10:00:00.5"));
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(12) {
|
||||
'year' => int(2006)
|
||||
'month' => int(12)
|
||||
'day' => int(12)
|
||||
'hour' => int(10)
|
||||
'minute' => int(0)
|
||||
'second' => int(0)
|
||||
'fraction' => double(0.5)
|
||||
'warning_count' => int(0)
|
||||
'warnings' => array(0) {
|
||||
["year"]=>
|
||||
int(2006)
|
||||
["month"]=>
|
||||
int(12)
|
||||
["day"]=>
|
||||
int(12)
|
||||
["hour"]=>
|
||||
int(10)
|
||||
["minute"]=>
|
||||
int(0)
|
||||
["second"]=>
|
||||
int(0)
|
||||
["fraction"]=>
|
||||
float(0.5)
|
||||
["warning_count"]=>
|
||||
int(0)
|
||||
["warnings"]=>
|
||||
array(0) {
|
||||
}
|
||||
'error_count' => int(0)
|
||||
'errors' => array(0) {
|
||||
["error_count"]=>
|
||||
int(0)
|
||||
["errors"]=>
|
||||
array(0) {
|
||||
}
|
||||
'is_localtime' => bool(false)
|
||||
["is_localtime"]=>
|
||||
bool(false)
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
@@ -193,25 +205,42 @@ var_dump(date_parse("June 2nd, 2022, 10:28:17 BST"));
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(16) {
|
||||
'year' => int(2022)
|
||||
'month' => int(6)
|
||||
'day' => int(2)
|
||||
'hour' => int(10)
|
||||
'minute' => int(28)
|
||||
'second' => int(17)
|
||||
'fraction' => double(0)
|
||||
'warning_count' => int(0)
|
||||
'warnings' => array(0) {
|
||||
["year"]=>
|
||||
int(2022)
|
||||
["month"]=>
|
||||
int(6)
|
||||
["day"]=>
|
||||
int(2)
|
||||
["hour"]=>
|
||||
int(10)
|
||||
["minute"]=>
|
||||
int(28)
|
||||
["second"]=>
|
||||
int(17)
|
||||
["fraction"]=>
|
||||
float(0)
|
||||
["warning_count"]=>
|
||||
int(0)
|
||||
["warnings"]=>
|
||||
array(0) {
|
||||
}
|
||||
'error_count' => int(0)
|
||||
'errors' => array(0) {
|
||||
["error_count"]=>
|
||||
int(0)
|
||||
["errors"]=>
|
||||
array(0) {
|
||||
}
|
||||
'is_localtime' => bool(true)
|
||||
'zone_type' => int(2)
|
||||
'zone' => int(0)
|
||||
'is_dst' => bool(true)
|
||||
'tz_abbr' => string(3) "BST"
|
||||
}]]>
|
||||
["is_localtime"]=>
|
||||
bool(true)
|
||||
["zone_type"]=>
|
||||
int(2)
|
||||
["zone"]=>
|
||||
int(0)
|
||||
["is_dst"]=>
|
||||
bool(true)
|
||||
["tz_abbr"]=>
|
||||
string(3) "BST"
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<example>
|
||||
@@ -227,23 +256,38 @@ var_dump(date_parse("June 2nd, 2022, 10:28:17 Europe/London"));
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(14) {
|
||||
'year' => int(2022)
|
||||
'month' => int(6)
|
||||
'day' => int(2)
|
||||
'hour' => int(10)
|
||||
'minute' => int(28)
|
||||
'second' => int(17)
|
||||
'fraction' => double(0)
|
||||
'warning_count' => int(0)
|
||||
'warnings' => array(0) {
|
||||
["year"]=>
|
||||
int(2022)
|
||||
["month"]=>
|
||||
int(6)
|
||||
["day"]=>
|
||||
int(2)
|
||||
["hour"]=>
|
||||
int(10)
|
||||
["minute"]=>
|
||||
int(28)
|
||||
["second"]=>
|
||||
int(17)
|
||||
["fraction"]=>
|
||||
float(0)
|
||||
["warning_count"]=>
|
||||
int(0)
|
||||
["warnings"]=>
|
||||
array(0) {
|
||||
}
|
||||
'error_count' => int(0)
|
||||
'errors' => array(0) {
|
||||
["error_count"]=>
|
||||
int(0)
|
||||
["errors"]=>
|
||||
array(0) {
|
||||
}
|
||||
'is_localtime' => bool(true)
|
||||
'zone_type' => int(3)
|
||||
'tz_id' => string(13) "Europe/London"
|
||||
}]]>
|
||||
["is_localtime"]=>
|
||||
bool(true)
|
||||
["zone_type"]=>
|
||||
int(3)
|
||||
["tz_id"]=>
|
||||
string(13) "Europe/London"
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
@@ -265,21 +309,34 @@ var_dump(date_parse("June 2nd, 2022"));
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(12) {
|
||||
'year' => int(2022)
|
||||
'month' => int(6)
|
||||
'day' => int(2)
|
||||
'hour' => bool(false)
|
||||
'minute' => bool(false)
|
||||
'second' => bool(false)
|
||||
'fraction' => bool(false)
|
||||
'warning_count' => int(0)
|
||||
'warnings' => array(0) {
|
||||
["year"]=>
|
||||
int(2022)
|
||||
["month"]=>
|
||||
int(6)
|
||||
["day"]=>
|
||||
int(2)
|
||||
["hour"]=>
|
||||
bool(false)
|
||||
["minute"]=>
|
||||
bool(false)
|
||||
["second"]=>
|
||||
bool(false)
|
||||
["fraction"]=>
|
||||
bool(false)
|
||||
["warning_count"]=>
|
||||
int(0)
|
||||
["warnings"]=>
|
||||
array(0) {
|
||||
}
|
||||
'error_count' => int(0)
|
||||
'errors' => array(0) {
|
||||
["error_count"]=>
|
||||
int(0)
|
||||
["errors"]=>
|
||||
array(0) {
|
||||
}
|
||||
'is_localtime' => bool(false)
|
||||
}]]>
|
||||
["is_localtime"]=>
|
||||
bool(false)
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
@@ -301,30 +358,49 @@ var_dump(date_parse("2006-12-12 10:00:00.5 +1 week +1 hour"));
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(13) {
|
||||
'year' => int(2006)
|
||||
'month' => int(12)
|
||||
'day' => int(12)
|
||||
'hour' => int(10)
|
||||
'minute' => int(0)
|
||||
'second' => int(0)
|
||||
'fraction' => double(0.5)
|
||||
'warning_count' => int(0)
|
||||
'warnings' => array(0) {
|
||||
["year"]=>
|
||||
int(2006)
|
||||
["month"]=>
|
||||
int(12)
|
||||
["day"]=>
|
||||
int(12)
|
||||
["hour"]=>
|
||||
int(10)
|
||||
["minute"]=>
|
||||
int(0)
|
||||
["second"]=>
|
||||
int(0)
|
||||
["fraction"]=>
|
||||
float(0.5)
|
||||
["warning_count"]=>
|
||||
int(0)
|
||||
["warnings"]=>
|
||||
array(0) {
|
||||
}
|
||||
'error_count' => int(0)
|
||||
'errors' => array(0) {
|
||||
["error_count"]=>
|
||||
int(0)
|
||||
["errors"]=>
|
||||
array(0) {
|
||||
}
|
||||
'is_localtime' => bool(false)
|
||||
'relative' =>
|
||||
["is_localtime"]=>
|
||||
bool(false)
|
||||
["relative"]=>
|
||||
array(6) {
|
||||
'year' => int(0)
|
||||
'month' => int(0)
|
||||
'day' => int(7)
|
||||
'hour' => int(1)
|
||||
'minute' => int(0)
|
||||
'second' => int(0)
|
||||
["year"]=>
|
||||
int(0)
|
||||
["month"]=>
|
||||
int(0)
|
||||
["day"]=>
|
||||
int(7)
|
||||
["hour"]=>
|
||||
int(1)
|
||||
["minute"]=>
|
||||
int(0)
|
||||
["second"]=>
|
||||
int(0)
|
||||
}
|
||||
}]]>
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
@@ -349,31 +425,51 @@ var_dump(date_parse("Thursday, June 2nd"));
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(13) {
|
||||
'year' => bool(false)
|
||||
'month' => int(6)
|
||||
'day' => int(2)
|
||||
'hour' => int(0)
|
||||
'minute' => int(0)
|
||||
'second' => int(0)
|
||||
'fraction' => double(0)
|
||||
'warning_count' => int(0)
|
||||
'warnings' => array(0) {
|
||||
["year"]=>
|
||||
bool(false)
|
||||
["month"]=>
|
||||
int(6)
|
||||
["day"]=>
|
||||
int(2)
|
||||
["hour"]=>
|
||||
int(0)
|
||||
["minute"]=>
|
||||
int(0)
|
||||
["second"]=>
|
||||
int(0)
|
||||
["fraction"]=>
|
||||
float(0)
|
||||
["warning_count"]=>
|
||||
int(0)
|
||||
["warnings"]=>
|
||||
array(0) {
|
||||
}
|
||||
'error_count' => int(0)
|
||||
'errors' => array(0) {
|
||||
["error_count"]=>
|
||||
int(0)
|
||||
["errors"]=>
|
||||
array(0) {
|
||||
}
|
||||
'is_localtime' => bool(false)
|
||||
'relative' =>
|
||||
["is_localtime"]=>
|
||||
bool(false)
|
||||
["relative"]=>
|
||||
array(7) {
|
||||
'year' => int(0)
|
||||
'month' => int(0)
|
||||
'day' => int(0)
|
||||
'hour' => int(0)
|
||||
'minute' => int(0)
|
||||
'second' => int(0)
|
||||
'weekday' => int(4)
|
||||
["year"]=>
|
||||
int(0)
|
||||
["month"]=>
|
||||
int(0)
|
||||
["day"]=>
|
||||
int(0)
|
||||
["hour"]=>
|
||||
int(0)
|
||||
["minute"]=>
|
||||
int(0)
|
||||
["second"]=>
|
||||
int(0)
|
||||
["weekday"]=>
|
||||
int(4)
|
||||
}
|
||||
}]]>
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
|
||||
@@ -67,12 +67,12 @@
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"latitude" -- The Latitude as signed double.
|
||||
"latitude" -- The Latitude as signed <type>float</type>.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
"longitude" -- The Longitude as signed double.
|
||||
"longitude" -- The Longitude as signed <type>float</type>.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<term><parameter>factors</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
An array of doubles representing the sampling factor for each color component (in RGB order).
|
||||
An array of <type>float</type>s representing the sampling factor for each color component (in RGB order).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
<para>
|
||||
Returns the opacity of stroked object outlines.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
@@ -29,7 +26,7 @@
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a double describing the opacity.
|
||||
Returns a <type>float</type> describing the opacity.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -14,11 +14,8 @@
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the width of the stroke used to draw object outlines.
|
||||
Returns the width of the stroke used to draw object outlines.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
@@ -29,7 +26,7 @@
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a double describing the stroke width.
|
||||
Returns a <type>float</type> describing the stroke width.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
Imagick object containing the reference image
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>metric</parameter></term>
|
||||
<listitem>
|
||||
@@ -56,7 +56,7 @@
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a double describing the channel distortion.
|
||||
Returns a <type>float</type> describing the channel distortion.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a double describing the opacity.
|
||||
Returns a <type>float</type> describing the opacity.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a double describing the stroke width.
|
||||
Returns a <type>float</type> describing the stroke width.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<methodparam choice="opt"><type>int</type><parameter role="reference">offset</parameter><initializer>&null;</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Parse a string into a double and a currency using the current formatter.
|
||||
Parse a string into a float and a currency using the current formatter.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
<entry>
|
||||
<link linkend="ini.serialize-precision">serialize_precision</link> is
|
||||
used instead of <link linkend="ini.precision">precision</link> when
|
||||
encoding double values.
|
||||
encoding <type>float</type> values.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
|
||||
@@ -11,16 +11,28 @@
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
These math functions will only handle values within the range of
|
||||
the <type>int</type> and <type>float</type> types on your computer
|
||||
(this corresponds currently to the C types long resp. double).
|
||||
If you need to handle bigger numbers, take a look at the <link
|
||||
linkend="book.bc">arbitrary precision math functions</link>.
|
||||
the <type>int</type> and <type>float</type> types.
|
||||
To handle larger numbers, take a look at the
|
||||
<link linkend="book.bc">arbitrary precision math</link> or
|
||||
<link linkend="book.gmp">GNU Multiple Precision functions</link> functions.
|
||||
</para>
|
||||
<simpara>
|
||||
See also the manual page on
|
||||
<link linkend="language.operators.arithmetic">arithmetic
|
||||
operators</link>.
|
||||
</simpara>
|
||||
|
||||
<section>
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member>
|
||||
<link linkend="language.operators.arithmetic">arithmetic operators</link>
|
||||
</member>
|
||||
<member>
|
||||
<link linkend="book.bc">Arbitrary precision math functions</link>
|
||||
</member>
|
||||
<member>
|
||||
<link linkend="book.gmp">GNU Multiple Precision functions</link>
|
||||
</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</section>
|
||||
</preface>
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
@@ -72,12 +72,20 @@
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
echo abs(-4.2); // 4.2 (double/float)
|
||||
echo abs(5); // 5 (integer)
|
||||
echo abs(-5); // 5 (integer)
|
||||
var_dump(abs(-4.2));
|
||||
var_dump(abs(5));
|
||||
var_dump(abs(-5));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
float(4.2)
|
||||
int(5)
|
||||
int(5)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<warning>
|
||||
<simpara>
|
||||
<function>base_convert</function> may lose precision on large numbers
|
||||
due to properties related to the internal "double" or "float" type used.
|
||||
due to properties related to the internal <type>float</type> type used.
|
||||
Please see the <link linkend="language.types.float">Floating point numbers</link>
|
||||
section in the manual for more specific information and limitations.
|
||||
</simpara>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<parameter>cas_token</parameter> parameter which is a unique 64-bit
|
||||
value assigned to the existing item by memcache. See the documentation for
|
||||
<methodname>Memcached::get*</methodname> methods for how to obtain this
|
||||
token. Note that the token is represented as a double due to the
|
||||
token. Note that the token is represented as a float due to the
|
||||
limitations of PHP's integer space.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
@@ -69,15 +69,15 @@
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>i</entry>
|
||||
<entry>corresponding variable has type integer</entry>
|
||||
<entry>corresponding variable has type <type>int</type></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>d</entry>
|
||||
<entry>corresponding variable has type double</entry>
|
||||
<entry>corresponding variable has type <type>float</type></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>s</entry>
|
||||
<entry>corresponding variable has type string</entry>
|
||||
<entry>corresponding variable has type <type>string</type></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>b</entry>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a double on success and &null; if not set.
|
||||
Returns a <type>float</type> on success and &null; if not set.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>void</type><methodname>Swoole\Server::taskWaitMulti</methodname>
|
||||
<methodparam><type>array</type><parameter>tasks</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>double</type><parameter>timeout_ms</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>float</type><parameter>timeout_ms</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<modifier>public</modifier> <methodname>Vtiful\Kernel\Excel::insertText</methodname>
|
||||
<methodparam><type>int</type><parameter>row</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>column</parameter></methodparam>
|
||||
<methodparam><type>string</type><type>int</type><type>double</type><parameter>data</parameter></methodparam>
|
||||
<methodparam><type class="union"><type>int</type><type>float</type><type>string</type></type><parameter>data</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>format</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
|
||||
Reference in New Issue
Block a user