jeroen Sun Aug 12 17:37:24 2001 EDT
Modified files:
/phpdoc/en/functions math.xml
Log:
Fix that rand() bug; double->float; better min() documentation;
possibly something else I don't remember right now :-)
Index: phpdoc/en/functions/math.xml
diff -u phpdoc/en/functions/math.xml:1.47 phpdoc/en/functions/math.xml:1.48
--- phpdoc/en/functions/math.xml:1.47 Thu Aug 9 03:17:51 2001
+++ phpdoc/en/functions/math.xml Sun Aug 12 17:37:24 2001
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.47 $ -->
+<!-- $Revision: 1.48 $ -->
<reference id="ref.math">
<title>Mathematical Functions</title>
<titleabbrev>Math</titleabbrev>
@@ -8,8 +8,9 @@
<title>Introduction</title>
<para>
These math functions will only handle values within the range of
- the long and double types on your computer. If you need to
- handle bigger numbers, take a look at the <link
+ the <type>integer</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="ref.bc">arbitrary precision math functions</link>.
</para>
<sect2 id="math.constants">
@@ -140,8 +141,8 @@
<para>
Returns the absolute value of number. If the argument number is
of type <type>float</type>, the return type is also <type>float</type>,
- otherwise it is <type>int</type> (as <type>float</type> usually has a
- bigger value range than <type>int</type>).
+ otherwise it is <type>integer</type> (as <type>float</type> usually has a
+ bigger value range than <type>integer</type>).
</para>
</refsect1>
</refentry>
@@ -440,8 +441,8 @@
<title>Description</title>
<funcsynopsis>
<funcprototype>
- <funcdef>double <function>deg2rad</function></funcdef>
- <paramdef>double <parameter>number</parameter></paramdef>
+ <funcdef>float <function>deg2rad</function></funcdef>
+ <paramdef>float <parameter>number</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -579,7 +580,7 @@
<title>Description</title>
<funcsynopsis>
<funcprototype>
- <funcdef>double <function>lcg_value</function></funcdef>
+ <funcdef>float <function>lcg_value</function></funcdef>
<paramdef>void</paramdef>
</funcprototype>
</funcsynopsis>
@@ -652,14 +653,14 @@
<para>
If the first parameter is an array, <function>max</function>
returns the highest value in that array. If the first parameter
- is an integer, string or double, you need at least two parameters
+ is an integer, string or float, you need at least two parameters
and <function>max</function> returns the biggest of these values.
You can compare an unlimited number of values.
</para>
<para>
- If one or more of the values is a double, all the values will be
- treated as doubles, and a double is returned. If none of the
- values is a double, all of them will be treated as integers, and
+ If one or more of the values is a float, all the values will be
+ treated as floats, and a float is returned. If none of the
+ values is a float, all of them will be treated as integers, and
an integer is returned.
</para>
</refsect1>
@@ -674,10 +675,14 @@
<title>Description</title>
<funcsynopsis>
<funcprototype>
- <funcdef>mixed <function>min</function></funcdef>
- <paramdef>mixed <parameter>arg1</parameter></paramdef>
- <paramdef>mixed <parameter>arg2</parameter></paramdef>
- <paramdef>mixed <parameter>argn</parameter></paramdef>
+ <funcdef>number <function>min</function></funcdef>
+ <paramdef>number <parameter>arg1</parameter></paramdef>
+ <paramdef>number <parameter>arg2</parameter></paramdef>
+ <paramdef><parameter><optional>...</optional></parameter></paramdef>
+ </funcprototype>
+ <funcprototype>
+ <funcdef>number <function>min</function></funcdef>
+ <paramdef>array <parameter>numbers</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -685,17 +690,20 @@
parameter values.
</para>
<para>
- If the first parameter is an array, <function>min</function>
- returns the lowest value in that array. If the first parameter
- is an integer, string or double, you need at least two parameters
+ In the first variant, you need at least two parameters
and <function>min</function> returns the lowest of these values.
You can compare an unlimited number of values.
</para>
<para>
- If one or more of the values is a double, all the values will be
- treated as doubles, and a double is returned. If none of the
- values is a double, all of them will be treated as integers, and
- an integer is returned.
+ In the second variant, <function>min</function>
+ returns the lowest value in <parameter>numbers</parameter>.
+ </para>
+ <para>
+ If one or more of the values is a <type>float</type>, all the values
+ will be
+ treated as floats, and a float is returned. If none of the
+ values is a float, all of them will be treated as <type>integer</type>s,
+ and an integer is returned.
</para>
</refsect1>
</refentry>
@@ -710,11 +718,15 @@
<funcsynopsis>
<funcprototype>
<funcdef>int <function>mt_rand</function></funcdef>
+ <void/>
+ </funcprototype>
+ <funcprototype>
+ <funcdef>int <function>mt_rand</function></funcdef>
<paramdef>int
- <parameter><optional>min</optional></parameter>
+ <parameter>min</parameter>
</paramdef>
<paramdef>int
- <parameter><optional>max</optional></parameter>
+ <parameter>max</parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
@@ -782,7 +794,7 @@
<informalexample>
<programlisting role="php">
// seed with microseconds since last "whole" second
-mt_srand ((double) microtime() * 1000000);
+mt_srand ((float) microtime() * 1000000);
$randval = mt_rand();
</programlisting>
</informalexample>
@@ -806,7 +818,7 @@
<funcsynopsis>
<funcprototype>
<funcdef>int <function>mt_getrandmax</function></funcdef>
- <paramdef>void</paramdef>
+ <void/>
</funcprototype>
</funcsynopsis>
<simpara>
@@ -945,7 +957,7 @@
<title>Description</title>
<funcsynopsis>
<funcprototype>
- <funcdef>double <function>pi</function></funcdef>
+ <funcdef>float <function>pi</function></funcdef>
<paramdef>void</paramdef>
</funcprototype>
</funcsynopsis>
@@ -1027,8 +1039,8 @@
<title>Description</title>
<funcsynopsis>
<funcprototype>
- <funcdef>double <function>rad2deg</function></funcdef>
- <paramdef>double <parameter>number</parameter></paramdef>
+ <funcdef>float <function>rad2deg</function></funcdef>
+ <paramdef>float <parameter>number</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -1051,11 +1063,15 @@
<funcsynopsis>
<funcprototype>
<funcdef>int <function>rand</function></funcdef>
+ <void/>
+ </funcprototype>
+ <funcprototype>
+ <funcdef>int <function>rand</function></funcdef>
<paramdef>int
- <parameter><optional>min</optional></parameter>
+ <parameter>min</parameter>
</paramdef>
<paramdef>int
- <parameter><optional>max</optional></parameter>
+ <parameter>max</parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
@@ -1098,8 +1114,8 @@
<title>Description</title>
<funcsynopsis>
<funcprototype>
- <funcdef>double <function>round</function></funcdef>
- <paramdef>double <parameter>val</parameter></paramdef>
+ <funcdef>float <function>round</function></funcdef>
+ <paramdef>float <parameter>val</parameter></paramdef>
<paramdef>int
<parameter><optional>precision</optional></parameter>
</paramdef>
@@ -1192,7 +1208,7 @@
<informalexample>
<programlisting role="php">
// seed with microseconds since last "whole" second
-srand ((double) microtime() * 1000000);
+srand ((float) microtime() * 1000000);
$randval = rand();
</programlisting>
</informalexample>
@@ -1245,5 +1261,5 @@
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-vim: ts=4 sw=4 et syntax=sgml
+vim: ts=1 sw=1 et syntax=sgml
-->