如何在x86 ASM中将整数转换为浮点值? [英] How to convert an integer to a floating point value in x86 ASM?
本文介绍了如何在x86 ASM中将整数转换为浮点值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将一个整数(二进制补码)乘以一个浮点常量.这是我所拥有的:
I need to multiply an integer (two's compliment) by a floating point constant. Here is what I have:
.data
pi dd 3.14
int dd 0ah
.code
fld pi
???
fmul ST(1), ST
如何将 int
转换为浮点值以便与 pi
相乘?
How can I convert int
to a floating point value for multiplying against pi
?
推荐答案
您需要 fild
指令.这里是一个参考: http://www.website.masmforum.com/tutorials/fptute/fpuchap5.htm
You need the fild
instruction. Here's one reference: http://www.website.masmforum.com/tutorials/fptute/fpuchap5.htm
这篇关于如何在x86 ASM中将整数转换为浮点值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文