# conversor from base 10 to base 3that doesnt work with big numbers • ### Question

• if i try small numbers it works all right but for example if i imput a 20 digits decimal number it doesnt convert it any way around this?

rey:
TextWindow.WriteLine("enter decimal number")
l=Text.GetLength(number)
TextWindow.WriteLine("lenght"+l)
dectotrin()
number=numero
trintodec()
number=numero
Goto rey
Sub dectotrin

'decimal a trinario
trinario=""
decimal=number

TextWindow.WriteLine(decimal)
While decimal>0
trin= Math.Remainder(decimal,3)
trinario= Text.Append(trin,trinario)
decimal=Math.Floor (decimal/3)
EndWhile

TextWindow.WriteLine("trinario  "+trinario)
numero=trinario

EndSub

Sub trintodec

'trinario a decimal
decimal=""
trinario=number
l= Text.GetLength(trinario)
For i=1 To l
dec=Text.GetSubText(trinario,i,1)
decimal=decimal*3+dec
EndFor

TextWindow.WriteLine("decimal  "+decimal)
numero=decimal
EndSub

Wednesday, May 8, 2013 9:20 PM

• Small Basic numbers are based on the 16 byte (128 bit) type called 'Decimal' (see here) with about 28 significant figures, much more than 999999999.

Most other languages C++ etc have the type called 'double' 8 byte - less precision (around 15 significant figures), but much larger and smaller numbers using exponents, e.g 1 google = 10^100 possible with a double (more than the number of atoms in the universe), but not a decimal.

There are exotic large number methods with high precision, but you usually have to write them yourself in the unusual situation where you need very large numbers and high precision (large number of significant figures).

• Edited by Wednesday, May 8, 2013 10:10 PM
• Marked as answer by Thursday, May 9, 2013 12:11 AM
Wednesday, May 8, 2013 9:34 PM

### All replies

• well i figured out the biggest number small basic can handle is 999999999

but isnt there a way around this even if it means changing language? i need it for the program im making

Wednesday, May 8, 2013 9:25 PM
• Small Basic numbers are based on the 16 byte (128 bit) type called 'Decimal' (see here) with about 28 significant figures, much more than 999999999.

Most other languages C++ etc have the type called 'double' 8 byte - less precision (around 15 significant figures), but much larger and smaller numbers using exponents, e.g 1 google = 10^100 possible with a double (more than the number of atoms in the universe), but not a decimal.

There are exotic large number methods with high precision, but you usually have to write them yourself in the unusual situation where you need very large numbers and high precision (large number of significant figures).

• Edited by Wednesday, May 8, 2013 10:10 PM
• Marked as answer by Thursday, May 9, 2013 12:11 AM
Wednesday, May 8, 2013 9:34 PM
• so for example if i wanted to use a text as a 24 base(the letters of the alphabet) it would turn out such  abig number i could no handle it in no language? for i would need both precision and size
Thursday, May 9, 2013 5:51 AM
• You should note that internally EVERYTHING is binary and the size of numbers in any base is limited by the number of Bytes and Bits in binary and this inturn affects the size and precision of calculations.  When we use the computer it converts the binary to letters, pictures or numbers decimal (base 10) or any other base octal (base 8), hex (base 16) etc purely for our convenience - how we display and use the numbers has no impact on the storage and calculations (always done in binary - this is fundamentally how microchips work).

So base 24 would also be stored and calculations done in binary internally.  Using base 24 you would have to write the conversions to any supported number type, Decimal, Double, Byte etc or if you are very preficient with C++ for example you write your own - a lot of work.

Thursday, May 9, 2013 8:17 AM
• You can do the simple calculations ( + - * / ) to about 29 digits, BUT the Math.Remainder() [and other Math...] functions do not go this far.

Try the following program

```c=1
For i= 1To 60
c=c*3
l=text.GetLength(c)
TextWindow.WriteLine(c+"     :"+i+" :"+l)
EndFor
TextWindow.WriteLine("")

c="12345678901234567890123456789"
c3=c/3
TextWindow.WriteLine(c)
TextWindow.WriteLine(3*c3)
TextWindow.WriteLine(c3)```

If you try a base 26 in the above program, you see you can calculate 26^20 in this way

Jan [ WhTurner ] The Netherlands

Thursday, May 9, 2013 9:33 AM
• thanks for the lead now i understand the amazing capabilities of small basic:

i intend to make a program where a subroutine is aditition and another substraction with an array as sumand1digit[i]th and sumand2digit[i]th so i can get numbers as big as i want

then make a subroutine multiplication and division aslike but i was wondering if i can lead the computation out of a subroutine to a second subroutine outside the 1st and then return to the original subroutine

like the subroutine multiplication making a more basic subroutine of adition

Friday, May 10, 2013 4:08 PM