Forum Discussion
Altera_Forum
Honored Contributor
15 years agoprinting floating point
Hi, is there any ways to print float number in Nios II? Example: a = 100, b = 195 c = (b-a)/100, so c = 0.95 so, how to print c = 0.95? because when i print, the answer is 0.
Altera_Forum
Honored Contributor
15 years agoAn integer divided by another integer regardless of how it's stored will be an integer result typecast to whatever the storage variable is after the operator completes. So after the division you would be left with an integer value of 0 which converted to floating point is just 0.0.
More info: http://en.wikipedia.org/wiki/type_conversion