1 |
|
2 |
|
3 | # Function bin
|
4 |
|
5 | Format a number as binary.
|
6 |
|
7 |
|
8 | ## Syntax
|
9 |
|
10 | ```js
|
11 | math.bin(value)
|
12 | ```
|
13 |
|
14 | ### Parameters
|
15 |
|
16 | Parameter | Type | Description
|
17 | --------- | ---- | -----------
|
18 | `value` | number | Value to be stringified
|
19 | `wordSize` | number | Optional word size (see `format`)
|
20 |
|
21 | ### Returns
|
22 |
|
23 | Type | Description
|
24 | ---- | -----------
|
25 | string | The formatted value
|
26 |
|
27 |
|
28 | ## Examples
|
29 |
|
30 | ```js
|
31 | //the following outputs "0b10"
|
32 | math.bin(2)
|
33 | ```
|
34 |
|
35 |
|
36 | ## See also
|
37 |
|
38 | [oct](oct.md),
|
39 | [hex](hex.md)
|