Change language to:
English - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
See the recommended documentation of this function

# dec2base

Convert decimal to base N number in string

### Syntax

str = dec2base(d, base)
str = dec2base(d, base, n)

### Arguments

str

matrix of strings corresponding to "base" representation

base

1-by-1 matrix of doubles, positive integer value, the base

d

matrix of doubles, positive integer values

### Description

str = dec2base(d, base) converts the nonnegative integer values of d to the specified base base.

d must have a nonnegative integers smaller than 2^52, and base must be an integer between 2 and 36.

The returned argument str is a matrix of strings.

str = dec2base(d, base, n) produces a representation with at least n digits.

### Examples

for b = 2:36
disp( dec2base(666, b) )
end

• base2dec — convert from base b to decimal
• bin2dec — convert from binary to decimal
• oct2dec — convert from octal to decimal
• hex2dec — convert from hexadecimal to decimal
• dec2bin — convert from decimal to binary
• dec2oct — convert from decimal to octal
• dec2hex — représentation hexadécimale d'un entier

### History

 Version Description 5.4.0 This function was added in Scilab 5.4.0
 Report an issue << bin2dec Bases de numération dec2bin >>

 Copyright (c) 2022-2024 (Dassault Systèmes)Copyright (c) 2017-2022 (ESI Group)Copyright (c) 2011-2017 (Scilab Enterprises)Copyright (c) 1989-2012 (INRIA)Copyright (c) 1989-2007 (ENPC)with contributors Last updated:Mon Feb 12 19:15:26 CET 2018