当前位置:天才代写 > tutorial > C语言/C++ 教程 > Vdsp(bf561)中的浮点运算(1):文档的说法

Vdsp(bf561)中的浮点运算(1):文档的说法

2017-11-05 08:00 星期日 所属: C语言/C++ 教程 浏览:406

在vdsp提供的《VisualDSP++ 5.0 C/C++ Compiler and Library Manual for Blackfin Processors Revision 5.1, August 2008》中列出了vdsp支持的所有数据范例,个中与浮点有点的范例有:

Type Bit Size Number Representation sizeof returns
double 32 bits 32-bit IEEE single-precision 4
float 32 bits 32-bit IEEE single-precision 4
double 64 bits 64-bit IEEE double-precision 8
long double 64 bits 64-bit IEEE 8
fract16 16 bits signed 1.15 fract 2
fract32 32 bits signed 1.31 fract 4

个中前4个回收了IEEE的名目,而fract则是ADI本身界说的名目。

在这里容易夹杂的一点是通过project options -> compilers中的参数设置可以节制利用的double范例是32位的照旧64位的,可恶的是在默认环境下,vdsp是将double当成32位来处理惩罚的,这对付某些科学计较相关的代码来说的确是一个恶梦!

虽然了,由于bf561硬件自己不支持浮点运算,只能通过软件模仿来实现,所以文档中这样表明为什么默认环境下要利用32位的double:

On Blackfin processors, the float data type is 32 bits, and the double data type default size is 32 bits. This size is chosen because it is the most efficient. The 64-bit long double data type is available if more precision is needed, although this is more costly because the type exceeds the data sizes supported natively by hardware.

好像委曲也说得已往。

但由此造成的一个问题是:假如在要利用的dlb库和挪用者之间是利用差异的选项来编译的,那么将造成措施运行时不行制止的错误!

 

    关键字:

天才代写-代写联系方式