Scientific Number Base Converter

Scientific notation for non base ten numbers.
This applet requires a Java browser

Example:

base 10: 1.234567e+6 (1234567)
base 16: 1.2D687_+5 (12D687)

Help:

Base is also called radix. For selecting input radix you can also input 12345@16 or 1.2345_+4@16 .
Note that for numbers in base other than ten you can't use 'E' for denoting a exponent but use '_'.
Single digit can't be bigger or equal to radix. Note also that exponents are also in selected radix rather then in base 10.

Theory:

Double precision type in C++ or Java holds a number represented in radix 2 coded binary. Standard that defines this is IEEE 754. It is a binary format used by all modern CPUs.
To convert any number that is represented exponentialy you need to divide or multiple it by target base until it is between 1 and base. (This can be done faster with logarithm.) When the number is between 1 and base it is easy to extract digits. What you need to do is assign by truncation your double var to integer. Now your integer var is the first digit in new base. Next you need to subtract first digit from your normalized number. When you have subtracted first digit from your number you need to multiple it by base and then extract second digit and so on . So you see you are using floating point instructions to convert your number to string or BCD (binary coded decimal).
Now lets think about logarithm. Note that every programing laguage has a standard library with log or ln function ; and PC processor has FPU assembler instructions for log2.
If exponentiation is multiplieing base by it self a number of times, logarithm is dividing a number by base and seeing how many times it can be divided. Having sead that, you can normalise your number by takeing a log base=your base of your number, round result by truncating and then divide your number by base^(truncated result). You will of course remember the log result because it is your new exponent in new base.
Log(base)(number)=Log2(number)/log2(base).
How many times you will extract a digit is also obtained by log: log2(base,(int) pow(2,52 bits)).

Algorithm for extracting digits from float:

double nb;
int base,e,p,i,pd;
pd=mypow(2,52); //double-52 bits extended-64 bits

e=mylog(base,nb);
if(e<0)e--;
nb=nb/mypow(base,e);
if(nb>=base){nb/=base;e++;}

p=mylog(base,pd); //precision

while(p>0){
str[i]=nb; //extracting digit by truncation
nb-=str[i]; //subtracting truncated digit
nb*=base;
p--;
i++;
}
i--;