Hello all: In my program I have the following code...
This all works just fine until I enter two numbers such as .005 + .005 The answer is in scientific notation 1.000000e-002 How do I convert this to the answer of .01 The same for .005 * .005 = 2.500000e-005 for multiplying. Thanks in advance Bob :rolleyes:
.elseif uMsg == WM_COMMAND .if wParam == 1000 ;convert 1st text finit ;Initalise the FPU FltIn addr R8t, 100 ;get input from editbox 1 fld R8t ;load R8t into st(0) FltIn addr R8t, 101 ;get input from editbox 2 fadd R8t ;add R8t to st(0) fstp R8t ;pop st(0) into R8t FltOut R8t, 102 ;get Rt8 and put into editbox 3 .elseif wParam == 1003 ;convert 1st text finit ;Initalise the FPU FltIn addr R8t, 100 ;get input from editbox 1 fld R8t ;load R8t into st(0) FltIn addr R8t, 101 ;get input from editbox 2 fmul R8t ;multiply R8t to st(0) fstp R8t ;pop st(0) into R8t FltOut R8t, 102 ;get Rt8 and put into editbox 3 .elseif wParam == 1001 ;the exit button jmp LetsLeave
I don't think theres any easy way to do this, the FltOut macro uses the FloatToStr procedure from the m32lib included with masm32 and its that which displays results in scientific notation. You would have to edit that procedure (source code is included in m32lib folder) but that may not be worth the effort.
Hi Zadkiel: I was thinking along the lines of saving
somewhere else, then do the conversion and then put it into Edit box 3. It could be a hidden Edit box or something and then load it into edit box 3. I dunno. I will keep playing with it. Thanks for all your help, and your tutorials are really super. Bob. :)
FltOut R8t, 102 ;get Rt8 and put into editbox 3
A few months ago I was working on a floating point calculator. I wanted to be able to switch from floating point to fixed point and set number of significant digits displayed so I wrote some code to do this. I'm going to email you the source, obj, exe etc and you can play around with it. The program maybe got bugs in it and not a lot of comments but it works and maybe you find it helpful. best regards, czDrillard
Hello czDrillard: I received your email with the attached program and source codes etc., and it sure is an interesting program. I ran the exe and it does exactly what I want for my program. I am looking at the source code and rc file now. I will try to incorporate the needed procs into my program. Once again I would like to thank you for all the assistance you have given to a newcomer.:) I know I will have lots of questions about the program, so I will be in touch. Thanks, Bob.
Hey, czDrillard, I was wonder if you could send me your code! Thanks in advance. :)
Hey Wolfao, Source and code on its way. Be warned, it maybe not best way to do what it does and feel free to improve or whatever. I think now there is a masm library that does some of this but I got the old masm and it didn't have one. The library I used was written by Ron Thomas so check his site for more FPU info. best regards, czDrillard