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

El Tangas
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 

mns
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 

El Tangas
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 

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


14 Jun 2015, 09:25 

mns
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 © 19992020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.