46 lines
631 B
Markdown
46 lines
631 B
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
# Function bin
|
|
|
|
Format a number as binary.
|
|
|
|
|
|
## Syntax
|
|
|
|
```js
|
|
math.bin(value)
|
|
```
|
|
|
|
### Parameters
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`value` | number | Value to be stringified
|
|
`wordSize` | number | Optional word size (see `format`)
|
|
|
|
### Returns
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
string | The formatted value
|
|
|
|
|
|
### Throws
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
|
|
|
|
## Examples
|
|
|
|
```js
|
|
//the following outputs "0b10"
|
|
math.bin(2)
|
|
```
|
|
|
|
|
|
## See also
|
|
|
|
[oct](oct.md),
|
|
[hex](hex.md)
|