$base » History » Version 2
Per Amundsen, 02/23/2014 12:24 PM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | *$base(N,inbase,outbase,zeropad,precision)* |
||
| 4 | |||
| 5 | Converts number N from inbase to outbase. The last two parameters are optional. |
||
| 6 | |||
| 7 | *Parameters* |
||
| 8 | |||
| 9 | N - The number to convert. |
||
| 10 | inbase - The base to convert from. |
||
| 11 | outbase - The base to convert to. |
||
| 12 | zeropad - Number of leading zero's to add. |
||
| 13 | precision - TODO |
||
| 14 | |||
| 15 | *Example* |
||
| 16 | |||
| 17 | <pre> |
||
| 18 | ;Returns F |
||
| 19 | //echo -ag $base(15,10,16) |
||
| 20 | |||
| 21 | ;Returns 1.8 |
||
| 22 | //echo -ag base(1.5,10,16) |
||
| 23 | |||
| 24 | 2 | Per Amundsen | ;Returns 002 |
| 25 | 1 | Per Amundsen | //echo -ag $base(2,10,16,3) |
| 26 | </pre> |