flat assembler
Message board for the users of flat assembler.
flat assembler
> DOS > convert exponent(binary) to decimal 
Author 

I suppose the most difficult is to calculate 10^0.zzzzzzzz. To do this, note that 10^0.zzzzzzz is z1*10^1/2*z2*10^1/4*z3*10^1/8*z4*10^1/16*.... so you can have the roots of 10 hardcoded, and multiply them according to the bit pattern in 0.zzzzzzzzz.


13 Jun 2015, 19:43 

sorry El Tangas, i still cannot understand.
when convert to binary exponent to decimal exponent(n) .zzzzzzzz will be a decimal number. for example it can be .457733... and will bit pattern of it work ? also,when using log 10 val = log 2 Val x log 10 2 is the result in the single precision format? if so, things will get more complicated. and now i really confused 

14 Jun 2015, 02:16 

Well, a number is a number, it doesn't matter if it's represented in binary or decimal. You want to to convert a mantissa suitable for exponents of 2 (that we can call binary) to a mantissa suitable for exponents of 10 (that we can call decimal), but these are just labels we can use for convenience. Both are just numbers. The binary representation will work.
You can do the operations in the FPU or use some custom fixed point format and do them with integer operations, you have to decide the exact implementation, probably will not be easy. 

14 Jun 2015, 09:06 

Maybe this post can help you: http://board.flatassembler.net/topic.php?p=1385#1385


14 Jun 2015, 09:25 

thank you
RIxRIpt, the calculator source is bit hard to understand.since it is one of the few examples on converting real to decimal that i could find, i have to understand it anyway.thanks again. 

14 Jun 2015, 18:03 

< Last Thread  Next Thread > 
Forum Rules:

Copyright © 19992019, Tomasz Grysztar.
Powered by rwasa.