Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

how to define a float data,in nios ide

i need to define a float data , which it is 16 bits , how can i define it , when i try float a; then my results usually be odd. too big or too small , not the data i want to get . so i think there may be fixed definition for float just like the interay data in altera we define them alt_16.:)

thanks a lot

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    because i have a fft code that run on int data , but i want to operat with floating data ,so i must change the data type , the int data it defined by alt_16, but in C, if i define a data in float ,it is 32 bit , so the number of bit is different ,, ........when i do so , the result of floating data is not what i want , so i thought the problem may be come from the definition .. whether i am wrong.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Sunjie,

    I missed the part about the NIOS IDE interface.

    Sorry about that.

    I would think that this type question would be better answered in the NIOS Forum section, rather then in the "Hardware" type sections that are mostly in here.

    Good luck,

    Avatar
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I think you're on your own with this problem. Some GPUs have a 16-bit floating point data type, but the C compiler for Nios does not.

    I'm sure that, if you built a C++ library for 16-bit floating point, other people would be interested in it too.