Shop OBEX P1 Docs P2 Docs Learn Events
Question to math.h — Parallax Forums

Question to math.h

ReinhardReinhard Posts: 489
edited 2011-12-11 10:09 in Propeller 1
Sorry if I have a new question

During the port of the NMEA Lib I get problems with __isnan( double) from math.h

so I tried to reduce the problem to this snippet
#include <math.h>
// math.h ->  int __isnan(double);

// propeller-elf-gcc -mlmm  -o isnan_test.elf  isnan_test.c -lm

void main ()
{
    double x;
    
    if(__isnan(x))
    {
        ;
    }

}

and get linker error :
D:\myC\propeller_chip\gcc\isnan>propeller-elf-gcc -mlmm -o isnan_test.elf isnan_test.c -lm
C:\DOKUME~1\Reinhard\LOKALE~1\Temp\cckHbArR.o: In function `_main':
(.text+0x2c): undefined reference to `___isnan'
collect2: ld returned 1 exit status

I have no problem to compile and link this snippet with dev-cpp

best Regards
Reinhard

Comments

  • ersmithersmith Posts: 6,099
    edited 2011-12-11 10:09
    Thank you for the bug report. That appears to be a build issue with our math library.

    We're working on a fix. You can work around it for now by using GCC's __builtin_isnan() in place of __isnan() or isnan(), e.g. by adding
    #if defined(__propeller__)
    #define __isnan(x) __builtin_isnan(x)
    #endif
    
    after the include of math.h.

    Eric
Sign In or Register to comment.