Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20803 Discussions

How to show float on console?

Altera_Forum
Honored Contributor II
1,124 Views

I want to print float on console. 

In code : 

double a; 

printf("the num is %f/n",a); 

but ,in nios the result is: 

the num is  

 

no float!who can help me ?
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
430 Views

If you are using the small newlib c library, it has not float support with printf() by specification.

0 Kudos
Altera_Forum
Honored Contributor II
430 Views

isn't %f for floats only? I believe you need %lf to print a double.

0 Kudos
Reply