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 agohow have you defined pio_tick and dma_tick? if you have non floating point in a division in C the integer aritmetic is used.
int a = 195; int b = 100; float c; a - b=95 c = 95/100 = 0 try putting casts to float (float)(a-b)/(float)a