Search the Community
Showing results for tags 'scfx_ieee_float'.
-
Dear all, I need to do floating point arithmetic in systemc. My question is if after I do two floating point addition or multiplication, can I call this api(is_inf()) for the sum or product to determine it is inf or not? The produced results looks correct for me. Like the following sample code ```c num1.negative(sign1); num2.negative(sign2); num1.exponent(exp1); num2.exponent(exp2); num1.mantissa(significand1); num2.mantissa(significand2); //the additiion result result = num1+num2; cout.precision(23); cout << result.is_inf() << " " << num1 << " " << num2 << " " << result << endl; ``` The following are my test samples: The first column is is_inf flag, the second and the third column are the source operands and the last column is the produced result. ``` 1 -3.402823466385288598117e+38 -3.402823466385288598117e+38 -inf 0 0.5 -0.20000000298023223876953 0.30000001192092895507812 0 0.5 -9.9999997473787516355515e-05 0.49990001320838928222656 0 0.5 -0.30000001192092895507812 0.19999998807907104492188 0 0.5 100 100.5 0 0.5 2003 2003.5 0 0.5 100000 100000.5 0 0.5 -1000000 -999999.5 ``` Any guidance is appreciate.
- 1 reply
-
- floating point
- systemc
-
(and 1 more)
Tagged with: