- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have to calculate an arctan on a CycloneV. Since HLS/ac_fixed_math.h does not include atan I use HLS/hls_float_math.h. Just now I run in trouble to convert the
ihc::hls_float <8, 23> s_tanf
variable to an
ac_int <16, false> s_tan = 0;
or better
ac_fixed <24, 8, true> s_tan = 0;
I found casting methods in hls_float.h but don't understand them.
Can you give me any hint on how to convert it?
Thanks
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi abaxor,
hls_float <8, 23> s_tanf is using IEEE 754 single-precision (binary32), 32bit to represent the data in binary value:
https://www.geeksforgeeks.org/ieee-standard-754-floating-point-numbers/
As for the ac_int and ac_fixed convertion, you can refer better to the below:
You can use any online IEEE-754 Floating Point Converter to test out the results of value you would like to convert and check if you are getting the correct output in your code based on how the value is defined with ac_int/ac_fixed.
Thanks.
Regards,
Aik Eu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your answer does not help at all. As you can see from my post, I am able to declare variables because I have read the documents you mentioned. However, I need a function or method to assign the value from s_tanf to s_tan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi abaxor,
Sorry that I may not fully understand your request regarding the conversion as you mentioned. Can share with me more details on your work?
There is some tutorial/design example in the HLS directory that may help with your understanding.
<quartus_installdir>//hls\examples\tutorials\ac_datatypes\ac_fixed_constructor
Refer to this link for more info:
Thanks.
Regards,
Aik Eu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi abaxor,
We do not receive any response from you to the previous question/reply/answer that I have provided. This thread will be transitioned to community support. If you have a new question, feel free to open a new thread to get the support from Intel experts. Otherwise, the community users will continue to help you on this thread. Thank you.
Thanks.
Regards,
Aik Eu

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page