RSQRSP指令即float _rcpsp (float src)函数需要包含(c6x.h文件),资源详情如下图所示。
描述:根据src2值返回给dst值,dst值是近似src2值平方根倒数的一个值。RSQRSP指令提供一个计算因子,精度是2-8,迭代一次精度翻倍,迭代2次获得满精度23bits。
使用方法:如下图公式所示,根据RSQRSP指令提供的一个初始因子X[0]去迭代,v值是想要得到平方根的值。
例:迭代一次n = 0,x[1],迭代第二次为x[2],最后使用这个x[2]的因子进行平方根计算,平方根 = v * x[2]。
注意点:
1) If src2 is SNaN, NaN_out is placed in dst and the INVAL and NAN2 bits are set.
2) If src2 is QNaN, NaN_out is placed in dst and the NAN2 bit is set.
3) If src2 is a negative, nonzero, nondenormalized number, NaN_out is placed in
dst and the INVAL bit is set.
4) If src2 is a signed denormalized number, signed infinity is placed in dst and the
DIV0, INEX, and DEN2 bits are set.
5) If src2 is signed 0, signed infinity is placed in dst and the DIV0 and INFO bits
are set. The Newton-Rhapson approximation cannot be used to calculate the
square root of 0 because infinity multiplied by 0 is invalid.
6) If src2 is positive infinity, positive 0 is placed in dst.