Re: Adding isinfl() and isnanl()

Joel Sherrill <[email protected]> Thu, 5 Feb 2026 18:53:12 -0600
Newsgroups gmane.comp.lib.newlib
Message-ID <CAF9ehCWaCZ5ZgSO6EmgNgVG+fwLd9qBCku=U_jAv54L=m0qCQA@mail.gmail.com>
On Thu, Feb 5, 2026 at 9:28 AM Corinna Vinschen <[email protected]> wrote:

> On Feb  5 09:09, Joel Sherrill wrote:
> > Hi
> >
> > math.h:123 has isinfl () and isnanl() as this:
> >
> > 123
> > <
> https://sourceware.org/git?p=newlib-cygwin.git;a=blob;f=newlib/libc/include/math.h;h=5e92d2662da145cabad51e5946051aa34e9092b6;hb=HEAD#l123
> >
> > #ifdef __CYGWIN__ /* not implemented in newlib yet */
> > 124
> > <
> https://sourceware.org/git?p=newlib-cygwin.git;a=blob;f=newlib/libc/include/math.h;h=5e92d2662da145cabad51e5946051aa34e9092b6;hb=HEAD#l124
> >
> > extern int isinfl (long double);
> > 125
> > <
> https://sourceware.org/git?p=newlib-cygwin.git;a=blob;f=newlib/libc/include/math.h;h=5e92d2662da145cabad51e5946051aa34e9092b6;hb=HEAD#l125
> >
> > extern int isnanl (long double);
> > 126
> > <
> https://sourceware.org/git?p=newlib-cygwin.git;a=blob;f=newlib/libc/include/math.h;h=5e92d2662da145cabad51e5946051aa34e9092b6;hb=HEAD#l126
> >
> > #endif
> >
> > The winsup implementation has them as simple wrappers for the
> > corresponding built-in functions such as __builtin_isinf_sign().
> >
> > If I copied the winsup/ implementation and put each in a new file
> > in newlib/libm so they are always available, is that OK?
>
> Barring other problems, you should just move them out of winsup into
> newlib.
>
> > If so, any suggestions on location inside libm for simple wrappers
> > for the corresponding builtin?
>
> libm/common
>
> > What would the conditional guard need to be? Just Cygwin and RTEMS?
> > or more?
>
> I think this would have to be target cpu dependent.
>
> > Anything I am missing?
>
> Is it a safe bet that these builtins are available as inline functions
> on all supported target cpus and compilers?  Unimplemented builtins just
> point to their corresponding C lib function, isn't it?
>

Thanks. This one comment makes me want to avoid doing this.

I can easily test the ~15 RTEMS architectures but that leaves a lot
I can't easily check. I will see if the code using this can be done a
different
way. Suggestions on that?

--joel

>
>
> Corinna
>
>