Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > ebb1914cf182a88528b4547490db1dd8 > files > 297

kdewebdev-quanta-doc-3.5.9-2mdv2008.1.x86_64.rpm

<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000">

<FONT SIZE=-1><A HREF="contents.htm">Table of Contents</A> | <A HREF="netscape.htm">Previous</A>
 | <A HREF="object.htm">Next</A>
 | <A HREF="bklast.htm">Index</A>
</FONT><BR><BR>
<HR>

<H1><A NAME="Number"></A>
<A NAME="1193137">
 Number
</A></H1>
<A NAME="1198237">
Lets you work with numeric values. The <CODE>Number</CODE> object is an object wrapper for primitive numeric values.<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left COLSPAN=2 ROWSPAN=1><P><A NAME="1193141">
<I>Core object</I></A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193145">
<I>Implemented in</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193147">
JavaScript 1.1, NES 2.0</A></P><P><A NAME="1193819">
</A></P><P><A NAME="1193820">
JavaScript 1.2: modified behavior of <CODE>Number</CODE> constructor</A></P><P><A NAME="1193151">
</A></P><P><A NAME="1193821">
JavaScript 1.3: added <A HREF="number.htm#1193434"><CODE>toSource</CODE></A> method</A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1194435">
<I>ECMA version</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1194437">
ECMA-262</A></P>

</TABLE>
</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193152">
 Created by
</A></H4>

<A NAME="1193153">
The <CODE>Number</CODE> constructor:</A></P>
<PRE><A NAME="1193154">new Number(<I>value</I>)</A></PRE>
<H4><A NAME="Head3;"></A>
<A NAME="1193155">
 Parameters
</A></H4>

<A NAME="1193161">
<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left><PRE><A NAME="1193158">value</A></PRE><TD VALIGN=baseline ALIGN=left><P><A NAME="1193160">
The numeric value of the object being created.</A></P>

</TABLE>
</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193162">
 Description
</A></H4>

<A NAME="1193163">
The primary uses for the <CODE>Number</CODE> object are:</A></P>
<ul><P><LI><A NAME="1193164">
To access its constant properties, which represent the largest and smallest representable numbers, positive and negative infinity, and the Not-a-Number value.</A></LI>
<P><LI><A NAME="1193165">
To create numeric objects that you can add properties to. Most likely, you will rarely need to create a <CODE>Number</CODE> object.</A></LI>
</ul><A NAME="1193166">
The properties of <CODE>Number</CODE> are properties of the class itself, not of individual <CODE>Number</CODE> objects.</A></P>
<A NAME="1193167">
JavaScript 1.2: <CODE>Number(x)</CODE> now produces <CODE>NaN</CODE> rather than an error if <CODE>x</CODE> is a string that does not contain a well-formed numeric literal. For example, </A></P>
<PRE><A NAME="1193168">x=Number("three");</A></PRE><PRE><A NAME="1193169">document.write(x + "&lt;BR&gt;");</A></PRE><A NAME="1193170">
prints <CODE>NaN</CODE></A></P>
<A NAME="1197979">
You can convert any object to a number using the top-level <A HREF="toplev.htm#1064092"><CODE>Number</CODE></A> function.</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193171">
 Property Summary
</A></H4>

<A NAME="1193219">
<P><B></B>
<TABLE BORDER="2" CELLPADDING=5>
<TR><TH VALIGN=baseline ALIGN=left><B><A NAME="1193174">
<B>Property
</B></A><B><TH VALIGN=baseline ALIGN=left><B><A NAME="1193176">
<B>Description
</B></A><B>
<TR><TD VALIGN=baseline ALIGN=left><PRE><A NAME="1196298"><A HREF="number.htm#1196194"><CODE>constructor</CODE></A></A></PRE><TD VALIGN=baseline ALIGN=left><P><A NAME="1196300">
Specifies the function that creates an object's prototype.</A></P>
<TR><TD VALIGN=baseline ALIGN=left><PRE><A NAME="1193181"><A HREF="number.htm#1193249"><CODE>MAX_VALUE</CODE></A></A></PRE><TD VALIGN=baseline ALIGN=left><P><A NAME="1193183">
The largest representable number.</A></P>
<TR><TD VALIGN=baseline ALIGN=left><PRE><A NAME="1193188"><A HREF="number.htm#1193275"><CODE>MIN_VALUE</CODE></A></A></PRE><TD VALIGN=baseline ALIGN=left><P><A NAME="1193190">
The smallest representable number.</A></P>
<TR><TD VALIGN=baseline ALIGN=left><PRE><A NAME="1193195"><A HREF="number.htm#1193302"><CODE>NaN</CODE></A></A></PRE><TD VALIGN=baseline ALIGN=left><P><A NAME="1193197">
Special "not a number" value.</A></P>
<TR><TD VALIGN=baseline ALIGN=left><PRE><A NAME="1193202"><A HREF="number.htm#1193346"><CODE>NEGATIVE_INFINITY</CODE></A></A></PRE><TD VALIGN=baseline ALIGN=left><P><A NAME="1193204">
Special value representing negative infinity; returned on overflow.</A></P>
<TR><TD VALIGN=baseline ALIGN=left><PRE><A NAME="1193209"><A HREF="number.htm#1193380"><CODE>POSITIVE_INFINITY</CODE></A></A></PRE><TD VALIGN=baseline ALIGN=left><P><A NAME="1193211">
Special value representing infinity; returned on overflow.</A></P>
<TR><TD VALIGN=baseline ALIGN=left><PRE><A NAME="1193216"><A HREF="number.htm#1193415"><CODE>prototype</CODE></A></A></PRE><TD VALIGN=baseline ALIGN=left><P><A NAME="1193218">
Allows the addition of properties to a <CODE>Number</CODE> object.</A></P>

</TABLE>
<TABLE>
<TR><TD>
</TABLE>
</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193220">
 Method Summary
</A></H4>

<A NAME="1193240">
<P><B></B>
<TABLE BORDER="2" CELLPADDING=5>
<TR><TH VALIGN=baseline ALIGN=left><B><A NAME="1193223">
<B>Method
</B></A><B><TH VALIGN=baseline ALIGN=left><B><A NAME="1193225">
<B>Description
</B></A><B>
<TR><TD VALIGN=baseline ALIGN=left><PRE><A NAME="1193230"><A HREF="number.htm#1193434"><CODE>toSource</CODE></A></A></PRE><TD VALIGN=baseline ALIGN=left><P><A NAME="1193232">
Returns an object literal representing the specified Number object; you can use this value to create a new object. Overrides the <A HREF="object.htm#1193320"><CODE>Object.toSource</CODE></A> method.</A></P>
<TR><TD VALIGN=baseline ALIGN=left><PRE><A NAME="1193237"><A HREF="number.htm#1193464"><CODE>toString</CODE></A></A></PRE><TD VALIGN=baseline ALIGN=left><P><A NAME="1193239">
Returns a string representing the specified object. Overrides the <A HREF="object.htm#1193350"><CODE>Object.toString</CODE></A> method.</A></P>
<TR><TD VALIGN=baseline ALIGN=left><PRE><A NAME="1195277"><A HREF="number.htm#1195199"><CODE>valueOf</CODE></A></A></PRE><TD VALIGN=baseline ALIGN=left><P><A NAME="1195279">
Returns the primitive value of the specified object. Overrides the <A HREF="object.htm#1193540"><CODE>Object.valueOf</CODE></A> method.</A></P>

</TABLE>
<TABLE>
<TR><TD>
</TABLE>
</A></P>
<A NAME="1196162">
In addition, this object inherits the <A HREF="object.htm#1193628"><CODE>watch</CODE></A> and <A HREF="object.htm#1193499"><CODE>unwatch</CODE></A> methods from <A HREF="object.htm#1193136"><CODE>Object</CODE></A>.</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193241">
 Examples
</A></H4>

<A NAME="1193242">
<B>Example 1.</B> The following example uses the <CODE>Number</CODE> object's properties to assign values to several numeric variables:</A></P>
<PRE><A NAME="1193243">biggestNum = Number.MAX_VALUE<br>smallestNum = Number.MIN_VALUE<br>infiniteNum = Number.POSITIVE_INFINITY<br>negInfiniteNum = Number.NEGATIVE_INFINITY<br>notANum = Number.NaN</A></PRE><A NAME="1193244">
<B>Example 2.</B> The following example creates a <CODE>Number</CODE> object, <CODE>myNum</CODE>, then adds a <CODE>description</CODE> property to all <CODE>Number</CODE> objects. Then a value is assigned to the <CODE>myNum</CODE> object's <CODE>description</CODE> property.</A></P>
<PRE><A NAME="1193245">myNum = new Number(65)<br>Number.prototype.description=null<br>myNum.description="wind speed"</A></PRE>
<HR><H2><A NAME="Head2Ref;"></A>
<A NAME="1196194">
constructor
</A></H2>

<A NAME="1196195">
Specifies the function that creates an object's prototype. Note that the value of this property is a reference to the function itself, not a string containing the function's name.<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1196198">
<I>Property of</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1196203">
<A HREF="number.htm#1193137"><CODE>Number</CODE></A></A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1196205">
<I>Implemented in</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1196207">
JavaScript 1.1, NES 2.0</A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1196209">
<I>ECMA version</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1196211">
ECMA-262</A></P>

</TABLE>
</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1196212">
 Description
</A></H4>

<A NAME="1196216">
See <A HREF="object.htm#1193229"><CODE>Object.constructor</CODE></A>.</A></P>

<HR><H2><A NAME="Head2Ref;"></A>
<A NAME="1193249">
MAX_VALUE
</A></H2>

<A NAME="1193266">
The maximum numeric value representable in JavaScript.<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193252">
<I>Property of</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193257">
<A HREF="number.htm#1193137"><CODE>Number</CODE></A></A></P>
<TR><TD VALIGN=baseline ALIGN=left COLSPAN=2 ROWSPAN=1><P><A NAME="1193259">
<I>Static, Read-only</I></A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193263">
<I>Implemented in</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193265">
JavaScript 1.1, NES 2.0</A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1194452">
<I>ECMA version</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1194454">
ECMA-262</A></P>

</TABLE>
</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193267">
 Description
</A></H4>

<A NAME="1193268">
The <CODE>MAX_VALUE</CODE> property has a value of approximately 1.79E+308. Values larger than <CODE>MAX_VALUE</CODE> are represented as <CODE>"Infinity"</CODE>.</A></P>
<A NAME="1193269">
Because <CODE>MAX_VALUE</CODE> is a static property of <CODE>Number</CODE>, you always use it as <CODE>Number.MAX_VALUE</CODE>, rather than as a property of a <CODE>Number</CODE> object you created.</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193270">
 Examples
</A></H4>

<A NAME="1193271">
The following code multiplies two numeric values. If the result is less than or equal to <CODE>MAX_VALUE</CODE>, the <CODE>func1</CODE> function is called; otherwise, the <CODE>func2</CODE> function is called.</A></P>
<PRE><A NAME="1193272">if (num1 * num2 &lt;= Number.MAX_VALUE)<br>&nbsp;&nbsp;&nbsp;func1()<br>else<br>&nbsp;&nbsp;&nbsp;func2()</A></PRE>
<HR><H2><A NAME="Head2Ref;"></A>
<A NAME="1193275">
MIN_VALUE
</A></H2>

<A NAME="1193292">
The smallest positive numeric value representable in JavaScript.<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193278">
<I>Property of</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193283">
<A HREF="number.htm#1193137"><CODE>Number</CODE></A></A></P>
<TR><TD VALIGN=baseline ALIGN=left COLSPAN=2 ROWSPAN=1><P><A NAME="1193285">
<I>Static, Read-only</I></A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193289">
<I>Implemented in</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193291">
JavaScript 1.1, NES 2.0</A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1194471">
<I>ECMA version</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1194473">
ECMA-262</A></P>

</TABLE>
</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193293">
 Description
</A></H4>

<A NAME="1196879">
The <CODE>MIN_VALUE</CODE> property is the number closest to 0, not the most negative number, that JavaScript can represent.</A></P>
<A NAME="1196880">
<CODE>MIN_VALUE</CODE> has a value of approximately 5e-324. Values smaller than <CODE>MIN_VALUE</CODE> ("underflow values") are converted to 0.</A></P>
<A NAME="1193296">
Because <CODE>MIN_VALUE</CODE> is a static property of <CODE>Number</CODE>, you always use it as <CODE>Number.MIN_VALUE</CODE>, rather than as a property of a <CODE>Number</CODE> object you created.</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193297">
 Examples
</A></H4>

<A NAME="1193298">
The following code divides two numeric values. If the result is greater than or equal to <CODE>MIN_VALUE</CODE>, the <CODE>func1</CODE> function is called; otherwise, the <CODE>func2</CODE> function is called.</A></P>
<PRE><A NAME="1193299">if (num1 / num2 &gt;= Number.MIN_VALUE)<br>&nbsp;&nbsp;&nbsp;func1()<br>else<br>&nbsp;&nbsp;&nbsp;func2()</A></PRE>
<HR><H2><A NAME="Head2Ref;"></A>
<A NAME="1193302">
NaN
</A></H2>

<A NAME="1193303">
A special value representing Not-A-Number. This value is represented as the unquoted literal NaN.<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193306">
<I>Property of</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193311">
<A HREF="number.htm#1193137"><CODE>Number</CODE></A></A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193313">
<I> Read-only</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193315">
</A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193317">
<I>Implemented in</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193319">
JavaScript 1.1, NES 2.0</A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1194494">
<I>ECMA version</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1194496">
ECMA-262</A></P>

</TABLE>
</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193320">
 Description
</A></H4>

<A NAME="1193321">
JavaScript prints the value <CODE>Number.NaN</CODE> as <CODE>NaN</CODE>.</A></P>
<A NAME="1193322">
<CODE>NaN</CODE> is always unequal to any other number, including NaN itself; you cannot check for the not-a-number value by comparing to <CODE>Number.NaN</CODE>. Use the <B><A HREF="toplev.htm#1064024"></B><CODE>isNaN</CODE><B></A></B> function instead.</A></P>
<A NAME="1193326">
You might use the <CODE>NaN</CODE> property to indicate an error condition for a function that should return a valid number.</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193327">
 Examples
</A></H4>

<A NAME="1193328">
In the following example, if <CODE>month</CODE> has a value greater than 12, it is assigned NaN, and a message is displayed indicating valid values.</A></P>
<PRE><A NAME="1193329">var month = 13<br>if (month &lt; 1 || month &gt; 12) {<br>&nbsp;&nbsp;&nbsp;month = Number.NaN<br>&nbsp;&nbsp;&nbsp;alert("Month must be between 1 and 12.")<br>}</A></PRE>
<H4><A NAME="Head3;"></A>
<A NAME="1193330">
 See also
</A></H4>

<A NAME="1193343">
<CODE><A HREF="toplev.htm#1064064">NaN</A></CODE>, <A HREF="toplev.htm#1064024"><CODE>isNaN</CODE></A>, <A HREF="toplev.htm#1064132"><CODE>parseFloat</CODE></A>, <A HREF="toplev.htm#1064173"><CODE>parseInt</CODE></A> </A></P>

<HR><H2><A NAME="Head2Ref;"></A>
<A NAME="1193346">
NEGATIVE_INFINITY
</A></H2>

<A NAME="1193347">
A special numeric value representing negative infinity. This value is represented as the unquoted literal <CODE>"-Infinity"</CODE>.<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193350">
<I>Property of</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193355">
<A HREF="number.htm#1193137"><CODE>Number</CODE></A></A></P>
<TR><TD VALIGN=baseline ALIGN=left COLSPAN=2 ROWSPAN=1><P><A NAME="1193357">
<I>Static, Read-only</I></A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193361">
<I>Implemented in</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193363">
JavaScript 1.1, NES 2.0</A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1194499">
<I>ECMA version</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1194501">
ECMA-262</A></P>

</TABLE>
</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193364">
 Description
</A></H4>

<A NAME="1196964">
This value behaves slightly differently than mathematical infinity:</A></P>
<ul><LI><A NAME="1197134">
Any positive value, including <CODE>POSITIVE_INFINITY</CODE>, multiplied by <CODE>NEGATIVE_INFINITY</CODE> is <CODE>NEGATIVE_INFINITY</CODE>.
</A></LI><LI><A NAME="1197135">
Any negative value, including <CODE>NEGATIVE_INFINITY</CODE>, multiplied by <CODE>NEGATIVE_INFINITY</CODE> is <CODE>POSITIVE_INFINITY</CODE>.
</A></LI><LI><A NAME="1197109">
Zero multiplied by <CODE>NEGATIVE_INFINITY</CODE> is <CODE>NaN</CODE>.
</A></LI><LI><A NAME="1197304">
<CODE>NaN</CODE> multiplied by <CODE>NEGATIVE_INFINITY</CODE> is <CODE>NaN</CODE>.
</A></LI><LI><A NAME="1197305">
<CODE>NEGATIVE_INFINITY</CODE>, divided by any negative value except <CODE>NEGATIVE_INFINITY</CODE>, is <CODE>POSITIVE_INFINITY</CODE>.
</A></LI><LI><A NAME="1197467">
<CODE>NEGATIVE_INFINITY</CODE>, divided by any positive value except <CODE>POSITIVE_INFINITY</CODE>, is <CODE>NEGATIVE_INFINITY</CODE>.
</A></LI><LI><A NAME="1197441">
<CODE>NEGATIVE_INFINITY</CODE>, divided by either <CODE>NEGATIVE_INFINITY</CODE> or <CODE>POSITIVE_INFINITY</CODE>, is <CODE>NaN</CODE>.
</A></LI><LI><A NAME="1197517">
Any number divided by <CODE>NEGATIVE_INFINITY</CODE> is Zero.
</A></LI></ul><A NAME="1193366">
Because <CODE>NEGATIVE_INFINITY</CODE> is a static property of <CODE>Number</CODE>, you always use it as <CODE>Number.NEGATIVE_INFINITY</CODE>, rather than as a property of a <CODE>Number</CODE> object you created.</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193367">
 Examples
</A></H4>

<A NAME="1193368">
In the following example, the variable <CODE>smallNumber</CODE> is assigned a value that is smaller than the minimum value. When the <CODE>if</CODE> statement executes, <CODE>smallNumber</CODE> has the value <CODE>"-Infinity"</CODE>, so the <CODE>func1</CODE> function is called.</A></P>
<PRE><A NAME="1193369">var smallNumber = -Number.MAX_VALUE*10<br>if (smallNumber == Number.NEGATIVE_INFINITY)<br>&nbsp;&nbsp;&nbsp;func1()<br>else<br>&nbsp;&nbsp;&nbsp;func2()</A></PRE>
<H4><A NAME="Head3;"></A>
<A NAME="1193370">
 See also
</A></H4>

<A NAME="1193377">
<CODE><A HREF="toplev.htm#1063963">Infinity</A></CODE>, <CODE><A HREF="toplev.htm#1063988">isFinite</A></CODE></A></P>

<HR><H2><A NAME="Head2Ref;"></A>
<A NAME="1193380">
POSITIVE_INFINITY
</A></H2>

<A NAME="1193381">
A special numeric value representing infinity. This value is represented as the unquoted literal <CODE>"Infinity"</CODE>.<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193384">
<I>Property of</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193389">
<A HREF="number.htm#1193137"><CODE>Number</CODE></A></A></P>
<TR><TD VALIGN=baseline ALIGN=left COLSPAN=2 ROWSPAN=1><P><A NAME="1193391">
<I>Static, Read-only</I></A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193395">
<I>Implemented in</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193397">
JavaScript 1.1, NES 2.0</A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1194504">
<I>ECMA version</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1194506">
ECMA-262</A></P>

</TABLE>
</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193398">
 Description
</A></H4>

<A NAME="1197681">
This value behaves slightly differently than mathematical infinity:</A></P>
<ul><LI><A NAME="1197682">
Any positive value, including <CODE>POSITIVE_INFINITY</CODE>, multiplied by <CODE>POSITIVE_INFINITY</CODE> is <CODE>POSITIVE_INFINITY</CODE>.
</A></LI><LI><A NAME="1197683">
Any negative value, including <CODE>NEGATIVE_INFINITY</CODE>, multiplied by <CODE>POSITIVE_INFINITY</CODE> is <CODE>NEGATIVE_INFINITY</CODE>.
</A></LI><LI><A NAME="1197684">
Zero multiplied by <CODE>POSITIVE_INFINITY</CODE> is <CODE>NaN</CODE>.
</A></LI><LI><A NAME="1197685">
<CODE>NaN</CODE> multiplied by <CODE>POSITIVE_INFINITY</CODE> is <CODE>NaN</CODE>.
</A></LI><LI><A NAME="1197686">
<CODE>POSITIVE_INFINITY</CODE>, divided by any negative value except <CODE>NEGATIVE_INFINITY</CODE>, is <CODE>NEGATIVE_INFINITY</CODE>.
</A></LI><LI><A NAME="1197687">
<CODE>POSITIVE_INFINITY</CODE>, divided by any positive value except <CODE>POSITIVE_INFINITY</CODE>, is <CODE>POSITIVE_INFINITY</CODE>.
</A></LI><LI><A NAME="1197688">
<CODE>POSITIVE_INFINITY</CODE>, divided by either <CODE>NEGATIVE_INFINITY</CODE> or <CODE>POSITIVE_INFINITY</CODE>, is <CODE>NaN</CODE>.
</A></LI><LI><A NAME="1197689">
Any number divided by <CODE>POSITIVE_INFINITY</CODE> is Zero.
</A></LI></ul><A NAME="1193401">
Because <CODE>POSITIVE_INFINITY</CODE> is a static property of <CODE>Number</CODE>, you always use it as <CODE>Number.POSITIVE_INFINITY</CODE>, rather than as a property of a <CODE>Number</CODE> object you created.</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193402">
 Examples
</A></H4>

<A NAME="1193403">
In the following example, the variable <CODE>bigNumber</CODE> is assigned a value that is larger than the maximum value. When the <CODE>if</CODE> statement executes, <CODE>bigNumber</CODE> has the value <CODE>"Infinity"</CODE>, so the <CODE>func1</CODE> function is called.</A></P>
<PRE><A NAME="1193404">var bigNumber = Number.MAX_VALUE * 10<br>if (bigNumber == Number.POSITIVE_INFINITY)<br>&nbsp;&nbsp;&nbsp;func1()<br>else<br>&nbsp;&nbsp;&nbsp;func2()</A></PRE>
<H4><A NAME="Head3;"></A>
<A NAME="1193405">
 See also
</A></H4>

<A NAME="1193412">
<CODE><A HREF="toplev.htm#1063963">Infinity</A></CODE>, <CODE><A HREF="toplev.htm#1063988">isFinite</A></CODE></A></P>

<HR><H2><A NAME="Head2Ref;"></A>
<A NAME="1193415">
prototype
</A></H2>

<A NAME="1193416">
Represents the prototype for this class. You can use the prototype to add properties or methods to all instances of a class. For information on prototypes, see <A HREF="function.htm#1193426"><CODE>Function.prototype</CODE></A>.<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193422">
<I>Property of</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193427">
<A HREF="number.htm#1193137"><CODE>Number</CODE></A></A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193429">
<I>Implemented in</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193431">
JavaScript 1.1, NES 2.0</A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1194509">
<I>ECMA version</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1194511">
ECMA-262</A></P>

</TABLE>
</A></P>

<HR><H2><A NAME="Head2Ref;"></A>
<A NAME="1193434">
toSource
</A></H2>

<A NAME="1193436">
Returns a string representing the source code of the object.<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193439">
<I>Method of</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193444">
<A HREF="number.htm#1193137"><CODE>Number</CODE></A></A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193446">
<I>Implemented in</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193448">
JavaScript 1.3</A></P>

</TABLE>
</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193449">
 Syntax
</A></H4>

<PRE><A NAME="1193450">toSource()</A></PRE>
<H4><A NAME="Head3;"></A>
<A NAME="1193451">
 Parameters
</A></H4>

<A NAME="1193452">
None</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193453">
 Description
</A></H4>

<A NAME="1198134">
The <CODE>toSource</CODE> method returns the following values:</A></P>
<ul><LI><A NAME="1198135">
For the built-in <CODE>Number</CODE> object, <CODE>toSource</CODE> returns the following string indicating that the source code is not available:
</A></LI><PRE><A NAME="1198136">&nbsp;&nbsp;&nbsp;function Number() {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[native code]<br>&nbsp;&nbsp;&nbsp;}</A></PRE><LI><A NAME="1198137">
For instances of <CODE>Number</CODE>, <CODE>toSource</CODE> returns a string representing the source code.
</A></LI></ul><A NAME="1198138">
This method is usually called internally by JavaScript and not explicitly in code.</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193457">
 See also
</A></H4>

<A NAME="1193461">
<A HREF="object.htm#1193320"><CODE>Object.toSource</CODE></A></A></P>

<HR><H2><A NAME="Head2Ref;"></A>
<A NAME="1193464">
toString
</A></H2>

<A NAME="1193477">
Returns a string representing the specified Number object.<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193467">
<I>Method of</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193472">
<A HREF="number.htm#1193137"><CODE>Number</CODE></A></A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1193474">
<I>Implemented in</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1193476">
JavaScript 1.1</A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1194515">
<I>ECMA version</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1194517">
ECMA-262</A></P>

</TABLE>
 </A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193478">
 Syntax
</A></H4>

<PRE><A NAME="1193479">toString()<br>toString([<I>radix</I>])</A></PRE>
<H4><A NAME="Head3;"></A>
<A NAME="1193480">
 Parameters
</A></H4>

<A NAME="1193486">
<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left><PRE><A NAME="1193483">radix</A></PRE><TD VALIGN=baseline ALIGN=left><P><A NAME="1193485">
An integer between 2 and 36 specifying the base to use for representing numeric values.</A></P>

</TABLE>
</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1193487">
 Description
</A></H4>

<A NAME="1195154">
The <A HREF="number.htm#1193137"><CODE>Number</CODE></A> object overrides the <CODE>toString</CODE> method of the <A HREF="object.htm#1193136"><CODE>Object</CODE></A> object; it does not inherit <A HREF="object.htm#1193350"><CODE>Object.toString</CODE></A>. For <A HREF="number.htm#1193137"><CODE>Number</CODE></A> objects, the <CODE>toString</CODE> method returns a string representation of the object.</A></P>
<A NAME="1195161">
JavaScript calls the <CODE>toString</CODE> method automatically when a number is to be represented as a text value or when a number is referred to in a string concatenation.</A></P>
<A NAME="1195165">
For <A HREF="number.htm#1193137"><CODE>Number</CODE></A> objects and values, the built-in <CODE>toString</CODE> method returns the string representing the value of the number.</A></P>
<A NAME="1193490">
You can use <CODE>toString</CODE> on numeric values, but not on numeric literals:</A></P>
<PRE><A NAME="1193491">// The next two lines are valid<br>var howMany=10<br>alert("howMany.toString() is " + howMany.toString())</A></PRE><PRE><A NAME="1193492">// The next line causes an error<br>alert("45.toString() is " + 45.toString())</A></PRE>
<HR><H2><A NAME="Head2Ref;"></A>
<A NAME="1195199">
valueOf
</A></H2>

<A NAME="1195216">
Returns the primitive value of a Number object.<TABLE BORDER="0">
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1195202">
<I>Method of</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1195207">
<A HREF="number.htm#1193137"><CODE>Number</CODE></A></A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1195209">
<I>Implemented in</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1195211">
JavaScript 1.1</A></P>
<TR><TD VALIGN=baseline ALIGN=left><P><A NAME="1195213">
<I>ECMA version</I></A></P><TD VALIGN=baseline ALIGN=left><P><A NAME="1195215">
ECMA-262</A></P>

</TABLE>
</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1195217">
 Syntax
</A></H4>

<PRE><A NAME="1195218">valueOf()</A></PRE>
<H4><A NAME="Head3;"></A>
<A NAME="1195219">
 Parameters
</A></H4>

<A NAME="1195220">
None</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1195221">
 Description
</A></H4>

<A NAME="1195228">
The <CODE>valueOf</CODE> method of <A HREF="number.htm#1193137"><CODE>Number</CODE></A> returns the primitive value of a Number object as a number data type.</A></P>
<A NAME="1195235">
This method is usually called internally by JavaScript and not explicitly in code.</A></P>

<H4><A NAME="Head3;"></A>
<A NAME="1195236">
 Examples
</A></H4>

<PRE><A NAME="1195237">x = new Number();<br>alert(x.valueOf())&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//displays 0</A></PRE>
<H4><A NAME="Head3;"></A>
<A NAME="1195238">
 See also
</A></H4>

<A NAME="1195242">
<A HREF="object.htm#1193540"><CODE>Object.valueOf</CODE></A></A></P>

<HR>

<FONT SIZE=-1><A HREF="contents.htm">Table of Contents</A> | <A HREF="netscape.htm">Previous</A>
 | <A HREF="object.htm">Next</A>
 | <A HREF="bklast.htm">Index</A>
</FONT>
<P ALIGN=right>
<FONT SIZE=-2><I>Last Updated:  05/28/99  12:00:02</I></FONT>
<P> <CENTER>Copyright (c) 1999
<A HREF="http://home.netscape.com/misc/contact_info.html"
TARGET=_top>Netscape Communications Corporation</A></FONT>
</CENTER>
<P>
</BODY>
</HTML>