制表函数 Y=3.3\*log(2)(x^2+1)

发布于 2025-01-17 02:23:20 字数 921 浏览 3 评论 0原文

无法登录 masm64。我到底如何在我的代码中应用 fyl2x?我不知道在哪里应用这段代码。基本上是程序崩溃,或者数据不正确。这是我的代码:

\`include win64a.inc 
.data
\_x dq 3.0
\_op1 dq 3.3
\_op2 dq 1.0
\_zero dq 0.0
\_step dq 0.3
res1 dq 0
res2 dq 0
res3 dq 0
res4 dq 0
res5 dq 0
tit1 db "masm64. 
Equation execution on coprocessor.",0
buf dq 5 dup(0)
ifmt db "Вывод результата Y=3.3\*log(2)(x^2+1):",10,10,"
Result:  %d, %d, %d, %d, %d",0ah,0ah,
"Автор: Анатолий",0
.code
WinMain proc
sub rsp,28h; stack alignment 28h=40d=32d+8;  8 — return
mov rbp,rsp
finit
lea esi,res1
mov ecx, 5
fld1
m1: fld \_x
fmul \_x
fadd \_op2
fmul \_op1
fld \_x
fadd \_step
fstp \_x
loop m1
fisttp res1
fisttp res2
fisttp res3
fisttp res4
fisttp res5

invoke wsprintf,ADDR buf,ADDR ifmt, res5,res4,res3,res2,res1
invoke MessageBox,0,addr buf,addr tit1,MB_ICONINFORMATION;
invoke ExitProcess,0
WinMain endp
end\`

尝试了这个解决方案: FLD1 FLD X FYL2X 但我不明白如何在我的代码中应用它!

Can't log2 to masm64. How exactly do I apply fyl2x in my code? I can't figure out where to apply this piece of code. Basically, the program crashes, or incorrect data. Here is my code:

\`include win64a.inc 
.data
\_x dq 3.0
\_op1 dq 3.3
\_op2 dq 1.0
\_zero dq 0.0
\_step dq 0.3
res1 dq 0
res2 dq 0
res3 dq 0
res4 dq 0
res5 dq 0
tit1 db "masm64. 
Equation execution on coprocessor.",0
buf dq 5 dup(0)
ifmt db "Вывод результата Y=3.3\*log(2)(x^2+1):",10,10,"
Result:  %d, %d, %d, %d, %d",0ah,0ah,
"Автор: Анатолий",0
.code
WinMain proc
sub rsp,28h; stack alignment 28h=40d=32d+8;  8 — return
mov rbp,rsp
finit
lea esi,res1
mov ecx, 5
fld1
m1: fld \_x
fmul \_x
fadd \_op2
fmul \_op1
fld \_x
fadd \_step
fstp \_x
loop m1
fisttp res1
fisttp res2
fisttp res3
fisttp res4
fisttp res5

invoke wsprintf,ADDR buf,ADDR ifmt, res5,res4,res3,res2,res1
invoke MessageBox,0,addr buf,addr tit1,MB_ICONINFORMATION;
invoke ExitProcess,0
WinMain endp
end\`

Tried this solution:
FLD1 FLD X FYL2X
But I don't understand how to apply this in my code!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

Oo萌小芽oO 2025-01-24 02:23:20

试试这个代码:

fld1 ; Push 1 onto the FPU stack.
fld x ; Push x onto the FPU stack.
fyl2x ; Compute log base 2 of x and store the result on top of the FPU stack.

Try this code:

fld1 ; Push 1 onto the FPU stack.
fld x ; Push x onto the FPU stack.
fyl2x ; Compute log base 2 of x and store the result on top of the FPU stack.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文