Tranvick

Task3(B)

Jun 24th, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     double x = 1.0, ed = 1.0, res = 0.0, n = 1.0, eps = 1e-5, lres, sto = 100.0;
  9.     int a[3];
  10.     _asm {
  11.         lea esi, a
  12.         xor edx, edx
  13.         mov ecx, 3
  14. _lb1:
  15.         inc edx
  16.         fld res
  17.         fstp lres
  18.         fld x
  19.         fdiv n
  20.         fadd res
  21.         fstp res
  22.         fld x
  23.         fchs
  24.         fstp x
  25.         fld n
  26.         fadd ed
  27.         fstp n
  28.  
  29.         fld res
  30.         fsub lres
  31.         fabs
  32.         fsub eps
  33.  
  34.         ftst
  35.         fwait
  36.         fstsw ax
  37.         fstp lres
  38.         test ax, 04500h
  39.  
  40.         jz _lb1
  41.  
  42.         mov [esi], edx
  43.         add esi, 4
  44.  
  45.         fld eps
  46.         fdiv sto
  47.         fstp eps
  48.         loop _lb1
  49.  
  50.     }
  51.     cout << setprecision(15) << fixed << res << endl;
  52.     setlocale(LC_ALL, ".1251");
  53.     for (int i = 0; i < 3; ++i)
  54.         cout << 5 + 2 * i << " знаков после запятой - " << a[i] << endl;
  55.     return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment