cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
272 Views
Registered: ‎06-27-2018

ap_uint divied by float

Hi,

The value of ap_uint divided by float, it will be reciprocal in SDSoC, as following code. hard_func has been specified hardware function.

Is it known issue?

--------------------------------------------

#include <stdio.h>
#include <ap_int.h>
#include <ap_fixed.h>

void hard_func(float result[2]) {
    ap_uint<10> ap;
    float       f;

    ap = 10;
    f  = 2.0;
    result[0] = (float)(ap / f);
    result[1] = (float)(f / ap);
}

int main(int argc, char *argv[]) {

    float result[2];
    hard_func(result);

    printf("result 0 = %f\n", result[0]);
    printf("result 1 = %f\n", result[1]);

    return 0;
}

---------------------------------------------

result 0 = 0.200000
result 1 = 0.200000

0 Kudos