![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Mar 2006
Posts: 17
Rep Power: 0
![]() |
how to print floating point numbers
Programs computes the roots of Quadratic equations: Ax^2+Bx+C=0,it doesnot print the fractional part of roots.
How to print fractional part ? finit fstcw controlWd or controlWd,0000110000000000b fldcw controlWd output prompt1 output prompt2 input string,40 atod string mov A,eax output prompt3 input string,40 atod string mov B,eax output prompt4 input string,40 atod string mov C1,eax fild C1 ;value of C in ST0 fild A ;value of A in ST1 fmul ;A*C and in ST0 fild no ;4 in ST0 fmul ;4*A*C and in ST0 fild B ;B in ST0 fild B ;B in ST1 fmul ;B*B in ST0 fsubr ;B*B - ( 4*A*C) and in ST0 fsqrt ;Determinant( D ) = SQRT( B^2-4AC) and in ST0 fist no3 ;store D mov eax,no3 ;store D in eax fild B ;B in ST0 fchs ;-B in ST0 fsubr ;-B-D in ST0 fild no4 ;2 in ST0 fild A ;A in ST0 fmul ;2*A fdiv ;-B-D/2*A fist no5 ;store first root mov ebx,no5 ;store first root in ebx fild no3 ;D in ST0 fild B fchs fadd fild no4 fild A fmul fdiv fst no10 fist no7 mov ecx,no7 dtoa no6,ebx output print2 dtoa no9,ecx output print3 |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|