to
Change the unit of a value.
Syntax
x to unit | to(x | unit)
Parameters
| Name | Type | Description |
| x | Unit | Array | Matrix | The unit to be converted. |
| unit | Unit | Array | Matrix | New unit. Can be a string like "cm" |
Returns
Unit | Array | Matrix โ value with changed, fixed unit.
Examples
5 inch to cm
3.2kg to g
16 bytes in bits
toBest
Converts to the most appropriate display unit.
Syntax
toBest(x) | toBest(x | unitList)
Parameters
| Name | Type | Description |
| x | Unit | The unit to be converted |
| options | Object | Optional options object |
Returns
Unit โ Value converted to the best matching unit
Examples
toBest(unit(5000
m"))
toBest(unit(3500000
W"))
toBest(unit(0.000000123