|
From: morte on 19 Dec 2007 12:46 I have serious problem. I have to make a program which contvert number like 0,2365 in octal to decimal. I know that the the representation of that number is 2*8^(-1)+3*8^(-2)+6*8^(-3)+5*8^(-4). But how should I make a program in 0806 assembler, TASM 3.2 exactly, when I know that 8086 does not have support for FPU ? So the final question is how to count floating points numbers if i have only integers ?
From: santosh on 19 Dec 2007 13:06 morte(a)centrum.sk wrote: > I have serious problem. I have to make a program which contvert number > like 0,2365 in octal to decimal. I know that the the representation of > that number is 2*8^(-1)+3*8^(-2)+6*8^(-3)+5*8^(-4). But how should I > make a program in 0806 assembler, TASM 3.2 exactly, when I know that > 8086 does not have support for FPU ? So the final question is how to > count floating points numbers if i have only integers ? Use a floating point emulation package. There must a huge number of such stuff floating around on the Net for DOS. A Google search should do the trick.
From: Herbert Kleebauer on 19 Dec 2007 13:46 morte(a)centrum.sk wrote: > I have serious problem. I have to make a program which contvert number > like 0,2365 in octal to decimal. I know that the the representation of > that number is 2*8^(-1)+3*8^(-2)+6*8^(-3)+5*8^(-4). But how should I > make a program in 0806 assembler, TASM 3.2 exactly, when I know that > 8086 does not have support for FPU ? So the final question is how to > count floating points numbers if i have only integers ? You don't have a floating point but a fixed point number. 0.2365 (8) = 2365 (8) / 10000 (8) = 1269 (10) / 4096 (10) Now decimal divide 1269 by 4096 until you have as much as digits you want: 1269 : 4096 = 0.30981 12288 ----- 40200 36864 ----- 33360 32768 ----- 5920 4096 ---- 1824
From: Robert Redelmeier on 19 Dec 2007 14:39 morte(a)centrum.sk wrote in part: > I have serious problem. I have to make a program which > contvert number like 0,2365 in octal to decimal. I > know that the the representation of that number is > 2*8^(-1)+3*8^(-2)+6*8^(-3)+5*8^(-4). But how should I make a > program in 0806 assembler, TASM 3.2 exactly, when I know that > 8086 does not have support for FPU ? So the final question is > how to count floating points numbers if i have only integers ? This sounds suspiciously like school homework, but I will give you some ideas to get started: 00.4 has an exact representation in decimal as 0.5000000... So do all the [negative] powers of 2 [and 8]. You can build up the answer using multiple precision (multi-word) math. There are even more clever ways with multiplication. Floating point is not necessary for this problem -- you seem to be given fixed-point numbers for conversion. Floating-point numbers are nothing more than composite number with an integer/fractional part and an exponent part. Both are handled much as integers with different rules. -- Robert
|
Pages: 1 Prev: Bootstrapping DOS boot disk Next: the screen light of my portable pc is off |