Close
Close window
base - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

convert/base

convert between bases

Calling Sequence

convert(n, 'base', β)

convert(L, 'base', α, β)

Parameters

n

-

integer; number to be converted

L

-

list(nonnegint); digits of the base-α number to be converted to base-β

α

-

posint; base of the input number, whose base-α digits are given in L (least significant first)

β

-

posint; output base

Description

convert/base converts the base-10 integer n to base-β or converts the list of integers L from base-α to base-β, in which case we interpret L as the number k=1nopsLLkαk1. It is assumed that 0Lk<α.

The result is a list of the base-β digits of the converted input.

Examples

Convert numbers in base 10 to any other base. The answer will be given in reverse order (least significant digit first).

>

convert32&comma;base&comma;16

0&comma;2

(1)

The decimal number 17 written in base 3 is 122.

>

convert17&comma;base&comma;3

2&comma;2&comma;1

(2)

Convert the number 122 in base 3 to base 10. The number to be converted must be entered as a list in reverse order unless it is in base 10. The answer will be given in reverse order.

>

convert2&comma;2&comma;1&comma;base&comma;3&comma;10

7&comma;1

(3)

Convert between different bases. The first number after base must be the base in which the number in brackets is given.

>

convert0&comma;0&comma;0&comma;1&comma;base&comma;2&comma;8

0&comma;1

(4)
>

convert0&comma;1&comma;base&comma;8&comma;16

8

(5)
>

convert0&comma;2&comma;base&comma;16&comma;2

0&comma;0&comma;0&comma;0&comma;0&comma;1

(6)
>

convert0&comma;2&comma;base&comma;16&comma;32

0&comma;1

(7)


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /