Previous Page Next Page Contents

int2text -- convert an integer to a character string

Introduction

int2text(n, b) converts the integer n to a string that corresponds to the b-adic representation of n.

Call(s)

int2text(n <, b>)

Parameters

n - an integer
b - the base: an integer between 2 and 36. The default base is 10.

Returns

a character string.

Related Functions

coerce, expr2text, genpoly, numlib::g_adic, tbl2text, text2expr, text2int, text2list, text2tbl

Details

Example 1

Relative to the default base 10, int2text provides a mere datatype conversion from DOM_INT to DOM_STRING:

>> int2text(123), int2text(-45678)
                              "123", "-45678"

Example 2

The decimal integer 32 has the following binary representation:

>> int2text(32, 2)
                                 "100000"

The decimal integer 10^9 has the following hexadecimal representation:

>> int2text(10^9, 16)
                                "3B9ACA00"

Example 3

Negative integers can be converted as well:

>> int2text(-15, 8)
                                   "-17"

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000