Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
17 years ago

How to show float on console?

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 ?

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

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

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

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