#66 Z80 float support

closed
nobody
None
5
2009-05-18
2009-05-18
Sid_
No

Does Z80 supports float values ?

Even when I compiled, I defined the USE_FLOATS=1 but I always saw the message <NO FLOAT>.
Does it mean that SDCC does not support float values for Z80 ?

For instance, a simple code that returns the upper message :

#include<stdio.h>

float fvalue;

int main()
{
fvalue = 1.02;
printf("fvalue: %d\n",fvalue);
Break;
return 0;
}

Discussion

  • Raphael Neider

    Raphael Neider - 2009-05-18

    If Z80 supports foats as most other ports do, you need to recompile the library (printf_large.c) with USE_FLOATS defined.
    Alternatively (possibly easier), you can copy the library printf_large.c to your project, compile it (with -DUSE_FLOATS), and link it to your project before libsdcc.

    > printf("fvalue: %d\n",fvalue);

    I think you meant %f here?

    > Break;
    ... should probably be removed.

    Best regards,
    Raphael

    PS: If this works for you, please close this report.

     
  • Raphael Neider

    Raphael Neider - 2009-05-18
    • status: open --> pending
     
  • Sid_

    Sid_ - 2009-05-18

    It's correct tecodev.
    I recompile le printf_large.c code using the option -DUSE_FLOATS=1 and everythink is ok now.

    Thank you for your fast answer ;).

     
  • Sid_

    Sid_ - 2009-05-18
    • status: pending --> closed
     

Log in to post a comment.