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

How to show float on console?

Altera_Forum
Contributeur émérite II
1 293 Visites

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 Compliments
2 Réponses
Altera_Forum
Contributeur émérite II
599 Visites

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

0 Compliments
Altera_Forum
Contributeur émérite II
599 Visites

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

0 Compliments
Répondre