# Number

## Overview

Number values represent floating-point numbers.

For more information see: [Number (MDN)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number).

## Properties Summarized

| Type                                                     | Name                                     | Summary                                                             |
| -------------------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------- |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [MAX\_VALUE](#max_value)                 | The largest representable number.                                   |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [MIN\_VALUE](#min_value)                 | The smallest representable number.                                  |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [NEGATIVE\_INFINITY](#negative_infinity) | Special value representing negative infinity; returned on overflow. |
| [Object](/reference/servoycore/dev-api/js-lib/object.md) | [NaN](#nan)                              | Special "not a number" value.                                       |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [POSITIVE\_INFINITY](#positive_infinity) | Special value representing infinity; returned on overflow.          |

## Methods Summarized

| Type                                                     | Name                                                           | Summary                                                                                                   |
| -------------------------------------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toExponential()](#toexponential)                              | Returns a string representing the number in exponential notation.                                         |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toExponential(fractionDigits)](#toexponential-fractiondigits) | Returns a string representing the number in exponential notation.                                         |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toFixed()](#tofixed)                                          | Returns a string representing the number in fixed-point notation.                                         |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toFixed(digits)](#tofixed-digits)                             | Returns a string representing the number in fixed-point notation.                                         |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toLocaleString()](#tolocalestring)                            | Converts the number into a string which is suitable for presentation in the given locale.                 |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toPrecision()](#toprecision)                                  | Returns a string representing the number to a specified precision in fixed-point or exponential notation. |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toPrecision(precision)](#toprecision-precision)               | Returns a string representing the number to a specified precision in fixed-point or exponential notation. |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toString()](#tostring)                                        | Returns a string representing the specified Number object.                                                |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [toString(radix)](#tostring-radix)                             | Returns a string representing the specified Number object.                                                |

## Properties Detailed

### MAX\_VALUE

The largest representable number.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
application.output("Largest number: " + Number.MAX_VALUE);
```

### MIN\_VALUE

The smallest representable number.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
application.output("Smallest number: " + Number.MIN_VALUE);
```

### NEGATIVE\_INFINITY

Special value representing negative infinity; returned on overflow.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
application.output("Negative infinity: " + Number.NEGATIVE_INFINITY);
```

### NaN

Special "not a number" value.

**Type**\
[Object](/reference/servoycore/dev-api/js-lib/object.md)

**Sample**

```js
application.output("NaN: " + Number.NaN);
```

### POSITIVE\_INFINITY

Special value representing infinity; returned on overflow.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
application.output("Positive infinity: " + Number.POSITIVE_INFINITY);
```

## Methods Detailed

### toExponential()

Returns a string representing the number in exponential notation.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) A string representing the number in exponential notation.

**Sample**

```js
var n = 123.45678;
application.output(n.toExponential(3));
```

### toExponential(fractionDigits)

Returns a string representing the number in exponential notation.

**Parameters**

* [Number](/reference/servoycore/dev-api/js-lib/number.md) **fractionDigits** An integer specifying the number of digits after the decimal point. Defaults to as many digits as necessary to specify the number.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) A string representing the number in exponential notation.

**Sample**

```js
var n = 123.45678;
application.output(n.toExponential(3));
```

### toFixed()

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

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) A string representing the number in fixed-point notation.

**Sample**

```js
var n = 123.45678;
application.output(n.toFixed(3));
```

### toFixed(digits)

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

**Parameters**

* [Number](/reference/servoycore/dev-api/js-lib/number.md) **digits** The number of digits to appear after the decimal point. Defaults to 0.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) A string representing the number in fixed-point notation.

**Sample**

```js
var n = 123.45678;
application.output(n.toFixed(3));
```

### toLocaleString()

Converts the number into a string which is suitable for presentation in the given locale.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) A string representing the number in the current locale.

**Sample**

```js
var n = 1000000;
application.output(n.toLocaleString());
```

### toPrecision()

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

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) A string representing the number to a specified precision in fixed-point or exponential notation.

**Sample**

```js
var n = 123.45678;
application.output(n.toPrecision(5));
```

### toPrecision(precision)

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

**Parameters**

* [Number](/reference/servoycore/dev-api/js-lib/number.md) **precision** An integer specifying the number of significant digits.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) A string representing the number to a specified precision in fixed-point or exponential notation.

**Sample**

```js
var n = 123.45678;
application.output(n.toPrecision(5));
```

### toString()

Returns a string representing the specified Number object.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) A string representing the specified Number object.

**Sample**

```js
var n = 7;
application.output(n.toString()); //displays "7"
application.output(n.toString(2)); //displays "111"
```

### toString(radix)

Returns a string representing the specified Number object.

**Parameters**

* [Number](/reference/servoycore/dev-api/js-lib/number.md) **radix** An integer between 2 and 36 specifying the base to use for representing numeric values

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) A string representing the specified Number object.

**Sample**

```js
var n = 7;
application.output(n.toString()); //displays "7"
application.output(n.toString(2)); //displays "111"
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoycore/dev-api/js-lib/number.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
