如何计算任意一个电源/根? [英] How to calculate an arbitrary power/root?

查看:154
本文介绍了如何计算任意一个电源/根?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有需要提高一个数量的分数功率应用。目标平台是FPGA,我可以得到的估计上FPU的大小,但我需要一个算法提出一个数字来一个分数幂只是进行可行性研究。我假设浮点为最坏的情况下,我希望在实践中,我们将能够使用捷径,但现在我想表明,最坏的情况下,可以在我们的一部分来实现。

I have a application which needs to raise a number to a fractional power. The target platform is an FPGA and I can get estimates on an FPU size for it, but I need an algorithm for raising a number to a fractional power just for a feasibility study. I'm assuming floating point as a worst case, I expect in practice we will be able to use short cuts, but for now I want to show that worst case can be implemented on our part.

想我会问这里,看看是否有,我可以检出任何常用方法。我知道有这样的软件的方法,我想只是一个合理有效的算法开始。我会担心FPGA实现。

Thought I'd ask here and see if there were any common methods that I could checkout. I know there are software methods of doing this, I want just a reasonably efficient algorithm to start with. I'll worry about the FPGA implementation.

推荐答案

是您的输入范围内任意的,在一定范围内已知的?

Is your range of inputs arbitrary, or known within a certain range?

在这两种情况下,X M = EXP(M日志x)的,所以如果你能创建功能评价EXP(x)和日志(x)和有多重,你可能可以了,好了。

in either case, xm = exp(m log x), so if you can create functions to evaluate exp(x) and log(x) and have a multiply, you're probably all set.

你必须搞清楚你想怎么处理x的非正值。

You'll have to figure out how you want to handle nonpositive values of x.

(提示日志(X):如果这是 IEEE-754浮点,转移尾数如果有必要,直到你结束了一系列的数字2 K 2 K + 1 对于一些价值K.这让你对付一个2:1的范围中是不是太难逼近与多项式。然后你只需少量的可能性来处理指数和移位数目。

(hint for log(x): if this is IEEE-754 floating point, shift the significand if necessary until you end up with a range of numbers between 2k and 2k+1 for some value K. This lets you deal with a 2:1 range which isn't too hard to approximate with polynomials. Then you just have a small number of possibilities to handle for the exponent and the shift number.

相应提示为EXP(X):写X = K + b,其中0℃= B< 1和k是整数。然后EXP(x)的= EXP(k)的* EXP(二); b具有在有限的范围内且k具有离散的可能性有限。)

Corresponding hint for exp(x): write x = k+b where 0 <= b < 1 and k is an integer. Then exp(x) = exp(k)*exp(b); b has limited range and k has a limited number of discrete possibilities.)

(提示#2:数字可能制定出更好的对于x M = G(MF(X)),其中f(x)=登录 2 X和G (x)= 2 X

(hint #2: the numbers probably work out better for xm = g(m f(x)) where f(x) = log2x and g(x) = 2x.)

这篇关于如何计算任意一个电源/根?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆