X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6746dc89c47ed01b165cc1152533605f97eb8e8d..f562e4c6e5fac7bcb445985b99acbea4d706e6f0:/docs/output/Number.js diff --git a/docs/output/Number.js b/docs/output/Number.js new file mode 100644 index 00000000..a0abe773 --- /dev/null +++ b/docs/output/Number.js @@ -0,0 +1 @@ +Ext.data.JsonP.Number({"tagname":"class","html":"

Files

Creates a wrapper object to allow you to work with numerical values.

\n\n

The primary uses for the Number object are:

\n\n

If the argument cannot be converted into a number, it returns NaN.

\n\n

In a non-constructor context (i.e., without the new operator), Number can\nbe used to perform a type conversion.

\n\n

Using the Number object to assign values to numeric variables

\n\n

The following example uses the Number object's properties to assign values to\nseveral numeric variables:

\n\n
biggestNum = Number.MAX_VALUE;\nsmallestNum = Number.MIN_VALUE;\ninfiniteNum = Number.POSITIVE_INFINITY;\nnegInfiniteNum = Number.NEGATIVE_INFINITY;\nnotANum = Number.NaN;\n
\n\n

Using Number to convert a Date object

\n\n

The following example converts the Date object to a numerical value using\nNumber as a function:

\n\n
var d = new Date(\"December 17, 1995 03:24:00\");\nprint(Number(d));\n
\n\n

This displays \"819199440000\".

\n\n

The following example converts the Date object to a numerical value using\nNumber as a function:

\n\n
\nDocumentation for this class comes from MDN\nand is available under Creative Commons: Attribution-Sharealike license.\n
\n\n

Properties

Defined By

Instance Properties

Special value representing negative infinity; returned on overflow. ...

Special value representing negative infinity; returned on overflow.

\n\n

The value of Number.NEGATIVE_INFINITY is the same as the negative value of the global object's\nInfinity property.

\n\n

This value behaves slightly differently than mathematical infinity:

\n\n
    \n
  • Any positive value, including POSITIVE_INFINITY, multiplied by NEGATIVE_INFINITY is NEGATIVE_INFINITY.
  • \n
  • Any negative value, including NEGATIVE_INFINITY, multiplied by NEGATIVE_INFINITY is\nPOSITIVE_INFINITY.
  • \n
  • Zero multiplied by NEGATIVE_INFINITY is NaN.
  • \n
  • NaN multiplied by NEGATIVE_INFINITY is NaN.
  • \n
  • NEGATIVE_INFINITY, divided by any negative value except NEGATIVE_INFINITY, is\nPOSITIVE_INFINITY.
  • \n
  • NEGATIVE_INFINITY, divided by any positive value except POSITIVE_INFINITY, is\nNEGATIVE_INFINITY.
  • \n
  • NEGATIVE_INFINITY, divided by either NEGATIVE_INFINITY or POSITIVE_INFINITY, is NaN.
  • \n
  • Any number divided by NEGATIVE_INFINITY is Zero.
  • \n
\n\n\n

Several JavaScript methods (such as the Number constructor, parseFloat, and parseInt) return\nNaN if the value specified in the parameter is significantly lower than Number.MIN_VALUE.

\n\n

You might use the Number.NEGATIVE_INFINITY property to indicate an error condition that returns a\nfinite number in case of success. Note, however, that isFinite would be more appropriate in such\na case.

\n\n

In the following example, the variable smallNumber is assigned a value that is smaller than the\nminimum value. When the if statement executes, smallNumber has the value \"-Infinity\", so\nsmallNumber is set to a more manageable value before continuing.

\n\n
var smallNumber = (-Number.MAX_VALUE) * 2\nif (smallNumber == Number.NEGATIVE_INFINITY) {\n    smallNumber = returnFinite();\n}\n
\n
Special value representing infinity; returned on overflow. ...

Special value representing infinity; returned on overflow.

\n\n

The value of Number.POSITIVE_INFINITY is the same as the value of the global object's Infinity\nproperty.

\n\n

This value behaves slightly differently than mathematical infinity:

\n\n
    \n
  • Any positive value, including POSITIVE_INFINITY, multiplied by POSITIVE_INFINITY is\nPOSITIVE_INFINITY.
  • \n
  • Any negative value, including NEGATIVE_INFINITY, multiplied by POSITIVE_INFINITY is\nNEGATIVE_INFINITY.
  • \n
  • Zero multiplied by POSITIVE_INFINITY is NaN.
  • \n
  • NaN multiplied by POSITIVE_INFINITY is NaN.
  • \n
  • POSITIVE_INFINITY, divided by any negative value except NEGATIVE_INFINITY, is\nNEGATIVE_INFINITY.
  • \n
  • POSITIVE_INFINITY, divided by any positive value except POSITIVE_INFINITY, is\nPOSITIVE_INFINITY.
  • \n
  • POSITIVE_INFINITY, divided by either NEGATIVE_INFINITY or POSITIVE_INFINITY, is NaN.
  • \n
  • Any number divided by POSITIVE_INFINITY is Zero.
  • \n
\n\n\n

Several JavaScript methods (such as the Number constructor, parseFloat, and parseInt) return\nNaN if the value specified in the parameter is significantly higher than Number.MAX_VALUE.

\n\n

You might use the Number.POSITIVE_INFINITY property to indicate an error condition that returns a\nfinite number in case of success. Note, however, that isFinite would be more appropriate in such\na case.

\n\n

In the following example, the variable bigNumber is assigned a value that is larger than the\nmaximum value. When the if statement executes, bigNumber has the value \"Infinity\", so bigNumber\nis set to a more manageable value before continuing.

\n\n
var bigNumber = Number.MAX_VALUE * 2\nif (bigNumber == Number.POSITIVE_INFINITY) {\n    bigNumber = returnFinite();\n}\n
\n
Defined By

Static Properties

The largest positive representable number. ...

The largest positive representable number. The largest negative representable\nnumber is -MAX_VALUE.

\n\n

The MAX_VALUE property has a value of approximately 1.79E+308. Values larger than MAX_VALUE are\nrepresented as \"Infinity\".

\n\n

Because MAX_VALUE is a static property of Number, you always use it as Number.MAX_VALUE,\nrather than as a property of a Number object you created.

\n\n

The following code multiplies two numeric values. If the result is less than or equal to\nMAX_VALUE, the func1 function is called; otherwise, the func2 function is called.

\n\n
if (num1 * num2 <= Number.MAX_VALUE)\n    func1();\nelse\n    func2();\n
\n
The smallest positive representable number -- that is, the positive number\nclosest to zero (without actually being ze...

The smallest positive representable number -- that is, the positive number\nclosest to zero (without actually being zero). The smallest negative\nrepresentable number is -MIN_VALUE.

\n\n

The MIN_VALUE property is the number closest to 0, not the most negative number, that JavaScript\ncan represent.

\n\n

MIN_VALUE has a value of approximately 5e-324. Values smaller than MIN_VALUE (\"underflow\nvalues\") are converted to 0.

\n\n

Because MIN_VALUE is a static property of Number, you always use it as Number.MIN_VALUE,\nrather than as a property of a Number object you created.

\n\n

The following code divides two numeric values. If the result is greater than or equal to\nMIN_VALUE, the func1 function is called; otherwise, the func2 function is called.

\n\n
if (num1 / num2 >= Number.MIN_VALUE)\n    func1()\nelse\n    func2()\n
\n
 

Special \"not a number\" value.

\n

Special \"not a number\" value.

\n
Defined By

Methods

Creates new Number object. ...

Creates new Number object.

\n

Parameters

  • value : Object

    The numeric value of the object being created.

    \n

Returns

Returns a string representing the number in exponential notation. ...

Returns a string representing the number in exponential notation.

\n\n

A string representing a Number object in exponential notation with one digit before the decimal\npoint, rounded to fractionDigits digits after the decimal point. If the fractionDigits argument\nis omitted, the number of digits after the decimal point defaults to the number of digits necessary\nto represent the value uniquely.

\n\n

If you use the toExponential method for a numeric literal and the numeric literal has no exponent\nand no decimal point, leave a space before the dot that precedes the method call to prevent the dot\nfrom being interpreted as a decimal point.

\n\n

If a number has more digits that requested by the fractionDigits parameter, the number is rounded\nto the nearest number represented by fractionDigits digits. See the discussion of rounding in the\ndescription of the toFixed method, which also applies to toExponential.

\n\n
var num=77.1234;\n\nalert(\"num.toExponential() is \" + num.toExponential()); //displays 7.71234e+1\n\nalert(\"num.toExponential(4) is \" + num.toExponential(4)); //displays 7.7123e+1\n\nalert(\"num.toExponential(2) is \" + num.toExponential(2)); //displays 7.71e+1\n\nalert(\"77.1234.toExponential() is \" + 77.1234.toExponential()); //displays 7.71234e+1\n\nalert(\"77 .toExponential() is \" + 77 .toExponential()); //displays 7.7e+1\n
\n

Parameters

  • fractionDigits : Number

    An integer specifying the number of digits after the decimal\npoint. Defaults to as many digits as necessary to specify the number.

    \n

Returns

  • String

    Exponential notation of number.

    \n
Returns a string representing the number in fixed-point notation. ...

Returns a string representing the number in fixed-point notation.

\n

Parameters

  • digits : Number

    The number of digits to appear after the decimal point; this may be a\nvalue between 0 and 20, inclusive, and implementations may optionally support a larger range of\nvalues. If this argument is omitted, it is treated as 0.

    \n

Returns

  • String

    A string representation of number that does not use\nexponential notation and has exactly digits digits after the decimal place.\nThe number is rounded if necessary, and the fractional part is padded with\nzeros if necessary so that it has the specified length. If number is greater\nthan 1e+21, this method simply calls Number.toString() and returns a string\nin exponential notation.

    \n
Returns a human readable string representing the number using the locale of the\nenvironment. ...

Returns a human readable string representing the number using the locale of the\nenvironment. Overrides the Object.prototype.toLocaleString method.

\n\n

This method available to numbers will convert the number into a string which is suitable for\npresentation in the given locale.

\n\n
var number = 3500\nconsole.log(number.toLocaleString()); // Displays \"3,500\" in English locale\n
\n

Returns

  • String

    String representing the number.

    \n
Returns a string representing the number to a specified precision in fixed-\npoint or exponential notation. ...

Returns a string representing the number to a specified precision in fixed-\npoint or exponential notation.

\n\n

A string representing a Number object in fixed-point or\nexponential notation rounded to precision significant digits. See the\ndiscussion of rounding in the description of the toFixed method, which also\napplies to toPrecision.

\n\n

If the precision argument is omitted, behaves as Number.toString. If it is a\nnon-integer value, it is rounded to the nearest integer. After rounding, if\nthat value is not between 1 and 100 (inclusive), a RangeError is thrown.

\n

Parameters

  • precision : Number

    An integer specifying the number of significant digits.

    \n

Returns

  • String

    String that represents Number object.

    \n
Returns a string representing the specified object. ...

Returns a string representing the specified object. Overrides the\nObject.prototype.toString method.

\n\n

The Number object overrides the toString method of the Object object; it does not inherit\nObject.toString. For Number objects, the toString method returns a string representation of the\nobject in the specified radix.

\n\n

The toString method parses its first argument, and attempts to return a string representation in\nthe specified radix (base). For radixes above 10, the letters of the alphabet indicate numerals\ngreater than 9. For example, for hexadecimal numbers (base 16), A through F are used.

\n\n

If toString is given a radix not between 2 and 36, an exception is thrown.

\n\n

If the radix is not specified, JavaScript assumes the preferred radix is 10.

\n\n
var count = 10;\nprint(count.toString());   // displays \"10\"\nprint((17).toString());    // displays \"17\"\n\nvar x = 7;\nprint(x.toString(2));      // displays \"111\"\n
\n

Parameters

  • radix : Number

    An integer between 2 and 36 specifying the base to use for representing\nnumeric values.

    \n

Returns

  • String

    The number represented as a string.

    \n
Returns the primitive value of the specified object. ...

Returns the primitive value of the specified object. Overrides the\nObject.prototype.valueOf method.

\n\n

The valueOf method of Number returns the primitive value of a Number object as a number data\ntype.

\n\n

This method is usually called internally by JavaScript and not explicitly in code.

\n\n
var x = new Number();\nprint(x.valueOf());     // prints \"0\"\n
\n

Returns

  • Number

    The primitive value of the number.

    \n
","allMixins":[],"meta":{},"requires":[],"deprecated":null,"extends":null,"inheritable":false,"static":false,"superclasses":[],"singleton":false,"code_type":"nop","alias":null,"statics":{"property":[{"tagname":"property","deprecated":null,"static":true,"owner":"Number","template":null,"required":null,"protected":false,"name":"MAX_VALUE","id":"static-property-MAX_VALUE"},{"tagname":"property","deprecated":null,"static":true,"owner":"Number","template":null,"required":null,"protected":false,"name":"MIN_VALUE","id":"static-property-MIN_VALUE"},{"tagname":"property","deprecated":null,"static":true,"owner":"Number","template":null,"required":null,"protected":false,"name":"NaN","id":"static-property-NaN"}],"css_var":[],"css_mixin":[],"cfg":[],"method":[],"event":[]},"subclasses":[],"uses":[],"protected":false,"mixins":[],"members":{"property":[{"tagname":"property","deprecated":null,"static":false,"owner":"Number","template":null,"required":null,"protected":false,"name":"NEGATIVE_INFINITY","id":"property-NEGATIVE_INFINITY"},{"tagname":"property","deprecated":null,"static":false,"owner":"Number","template":null,"required":null,"protected":false,"name":"POSITIVE_INFINITY","id":"property-POSITIVE_INFINITY"}],"css_var":[],"css_mixin":[],"cfg":[],"method":[{"tagname":"method","deprecated":null,"static":false,"owner":"Number","template":false,"required":null,"protected":false,"name":"constructor","id":"method-constructor"},{"tagname":"method","deprecated":null,"static":false,"owner":"Number","template":false,"required":null,"protected":false,"name":"toExponential","id":"method-toExponential"},{"tagname":"method","deprecated":null,"static":false,"owner":"Number","template":false,"required":null,"protected":false,"name":"toFixed","id":"method-toFixed"},{"tagname":"method","deprecated":null,"static":false,"owner":"Number","template":false,"required":null,"protected":false,"name":"toLocaleString","id":"method-toLocaleString"},{"tagname":"method","deprecated":null,"static":false,"owner":"Number","template":false,"required":null,"protected":false,"name":"toPrecision","id":"method-toPrecision"},{"tagname":"method","deprecated":null,"static":false,"owner":"Number","template":false,"required":null,"protected":false,"name":"toString","id":"method-toString"},{"tagname":"method","deprecated":null,"static":false,"owner":"Number","template":false,"required":null,"protected":false,"name":"valueOf","id":"method-valueOf"}],"event":[]},"private":false,"component":false,"name":"Number","alternateClassNames":[],"id":"class-Number","mixedInto":[],"xtypes":{},"files":[{"href":"Number.html#Number","filename":"Number.js"}]}); \ No newline at end of file