Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. main:
  2. 6 mov eax, [esp+8]
  3. 7 mov eax, [eax+4] #arg[1]
  4. 8
  5. 9 finit
  6. 10
  7. 11 fldpi # pi
  8. 12 fld1 # 1
  9. 13 fld1 # 1
  10. 14 faddp # 2
  11. 15 fmulp # 2 * pi
  12. 16
  13. 17 push eax
  14. 18 call atof # x = atof(argv[1]);
  15. 19 fprem #x = x/2pi
  16. 20 pop eax
  17. 21
  18. 22 fld st(0) # y = x
  19. 23 fld st(0) # a = x
  20. 24
  21. 25 #sub esp, 0x8
  22. 26 mov ecx,1 # n = 1
  23. 27 jmp warunek
  24. 28 petla:
  25. 29 # x y a
  26. 30
  27. 31 fld st(2)
  28. 32
  29. 33 # x y a x
  30. 34
  31. 35 fmul st(0), st(0)
  32. 36
  33. 37 # x y a x^2
  34. 38
  35. 39 # teraz a *= x * x / ((n + 1) * (n + 2)) * -1;
  36. 40
  37. 41 lea eax, [ecx + 1]
  38. 42 lea ebx, [eax + 1]
  39. 43 mul ebx
  40. 44 neg eax
  41. 45 push eax
  42. 46 fild dword ptr [esp] # -1 / ((n + 1) * (n + 2))/laduje liczbe z danego a dresu i przeksztalca na rzeczwywista
  43. 47 pop eax
  44. 48
  45. 49 fdivp
  46. 50 fmulp
  47. 51
  48. 52 # x y a
  49. 53 # ^
  50. 54 # wierzch stosu
  51. 55
  52. 56 fld st(0)
  53. 57 # x y a a
  54. 58 # ^
  55. 59 # wierzch stosu
  56. 60
  57. 61 faddp st(2)
  58. 62 add ecx, 2
  59. 63
  60. 64 warunek:
  61. 65 fld st(0)
  62. 66 fabs # |a| st[0]
  63. 67 fld qword ptr eps
  64. 68 fcomip #st0 z st[i]
  65. 69 fstp st(0) # zdejmij |a|
  66. 70 jc petla # while |a| > eps
  67. 71
  68. 72 sub esp, 0x8
  69. 73 fstp st(0) # zdejmij a
  70. 74
  71. 75 fstp qword ptr [esp] # wstaw x na stos
  72. 76 lea eax, messg
  73. 77 push eax
  74. 78 call printf
  75. 79
  76. 80 add esp, 0xc # wyrównaj stos
  77. 81 ret
  78. 82
  79. 83 .data
  80. 84 eps: .double 0.0000001
  81. 85 messg: .asciz "wynik sinusa: %lg\n"
  82. 86
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement