01-12-2019 12:49 AM
Half doesn't seem to work... even a product is apparently wrong.
Is there something special to do, besides including "hls_half.h" and declaring variables as 'half'?
01-12-2019 06:57 AM
May need some additional info, but based on the fact you used 'product'... a product 'may' take more space than the terms being multiplied. Also, the magnitude of the value is expected to be in a very specific range...
• 1 signed bit
• 5 exponent bits
• 10 mantissa bits
Also, are you using the 'helper' function to print the result, or just a normal 'float' print and not casting? (e.g. maybe your value is fine, just you are displaying it wrong?)
Hope that helps
If so, please mark as solution accepted. Kudos also welcomed :-)
01-12-2019 08:19 AM
I'm using half as I don't need neither the float range or accuracy. Is actually nonsensical to have 10 digit resolution to produce a result that is good if within 10% of what is right.
The numbers I was multiplying were in the range of the tens... I first printed them out to the console straight away. Got zero. Then added a cast to float. Zero again... mmm... then debugger, added a watch to the variable with a cast to float..surprise!! I could see something like 0.1 * 0.5 being something like 1e-20.
I will try to repeat, document and attach the experiment and results