- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Everybody!!!
I created a custom instruction and it is not working for floating point. It worked only with integer value. I've used the macro that was defined in the Altera Manual: # define ALT_CI_TESTE_INST_N 0x00000000 # define ALT_CI_TESTE_INST (A) __builtin_custom_fnf(ALT_CI_TESTE_INST_N, (A)) By the manual should be working. Excerpt from my test code # include <stdio.h> # include "system.HA" int main () ( float x = ALT_CI_TESTE_INST (0.0); printf ( "Value:% f", x); return 0; ) The following appears on the console: ----------------- Value: ----------------- If anyone can help me, please respond. I am Brazilian and I do not know English very well, then no doubt, explain again. Thank you!!!!Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this instead:
float x = ALT_CI_TESTE_INST(0.0f); The 'f' tells the compiler to use a single precision value instead of double precision (default). There is also a flag you can pass to the compiler to tell it to treat all floating point constants as type 'float' instead of 'double' but I forget what to use (I don't recommend it either since you might accidentally break some code that needed to use double precision constants).
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page