有什么方法可以在emu8086中计算x ^ y?(x是整数,y是浮点数) [英] is there any way to calculate x^y in emu8086? (x is an integer and y is a float)
本文介绍了有什么方法可以在emu8086中计算x ^ y?(x是整数,y是浮点数)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个作业将计算PCB的走线宽度.如何在emu8086中计算此公式?(对不起,我的英语不好)
k是一个浮点数,temp_rise是一个整数,b是一个浮点数,c是一个浮点数
解决方案
您通常会使用 f2xm1
和 fyl2x
指令.像
fld yfild xfyl2x//计算y * log2(x)f2xm1//计算2 **(y * log2(x))-1(x ** y-1)fld1faddp//栈顶现在是x ** yfstp结果
I have a homework which will be calculate PCB trace width. How can I calculate this formula in emu8086?(Sorry for my bad english)
k is a float,temp_rise is an integer, b is a float, c is a float
解决方案
You would usually use the f2xm1
and fyl2x
instructions. Somthing like
fld y
fild x
fyl2x // compute y*log2(x)
f2xm1 // compute 2**(y*log2(x)) - 1 (which is x**y - 1)
fld1
faddp // top of stack is now x**y
fstp result
这篇关于有什么方法可以在emu8086中计算x ^ y?(x是整数,y是浮点数)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文