Bug# 38 baseConvert

Wouter wouter.abraham at pi.be
Tue Dec 9 10:58:30 CST 2003

Hi all,

in Bug# 38 on Bugzilla is stated:

baseConvert(x,16, 2) = 11111111111111111111111111111111
baseConvert(x,16,10) = -4294967295   <---

which should be :
unsigned int 4294967295
signed int -1


the reverse
baseConvert("4294967295",10,16)  -->  FFFFFFFF   (correct)
baseConvert("-4294967295",10,16) --> -FFFFFFFF  (negative hex, wow)
baseConvert("-1",10,16)                      --> -1  (hope it is not 
called a feature)


put baseconvert("D1310BA6",16,10)    -->  -3509652390 (correct)
put baseconvert("-3509652390",10,16) --> -D1310BA6  (wow again)

So the baseConvert(<expression>, 10, 16)  gives correct results when 
using unsigned integers up to 4294967295.
4294967296 gives the zero result.
But  the negative signed integers are considered as unsigned integers 
prefixed with a "-" and the result  is rendered as a prefixed hex.
baseConvert("-1",10,16) should result in FFFFFFF1 as 
baseConvert("F1",16,10) results in 241.
Or one should be able to choose between a signed or unsigned result in 
the baseConvert(<expression>, <source>, <dest>) function.

Working with hex and dec, my featurewishlist is expanding.

More information about the use-livecode mailing list