mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
60 lines
1.7 KiB
Markdown
60 lines
1.7 KiB
Markdown
---
|
|
layout: default
|
|
---
|
|
|
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
<h1 id="function-bignumber">Function bignumber <a href="#function-bignumber" title="Permalink">#</a></h1>
|
|
|
|
Create a BigNumber, which can store numbers with arbitrary precision.
|
|
When a matrix is provided, all elements will be converted to BigNumber.
|
|
|
|
|
|
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
math.bignumber(x)
|
|
```
|
|
|
|
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`value` | number | string | Fraction | BigNumber | bigint | Array | Matrix | boolean | null | Value for the big number, 0 by default.
|
|
|
|
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
BigNumber | The created bignumber
|
|
|
|
|
|
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
|
|
|
|
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
0.1 + 0.2 // returns number 0.30000000000000004
|
|
math.bignumber(0.1) + math.bignumber(0.2) // returns BigNumber 0.3
|
|
|
|
|
|
7.2e500 // returns number Infinity
|
|
math.bignumber('7.2e500') // returns BigNumber 7.2e500
|
|
```
|
|
|
|
|
|
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
|
|
|
|
[number](number.html),
|
|
[bigint](bigint.html),
|
|
[boolean](boolean.html),
|
|
[complex](complex.html),
|
|
[index](index.html),
|
|
[matrix](matrix.html),
|
|
[string](string.html),
|
|
[unit](unit.html)
|