• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: cmath, math.h, and isnan
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cmath, math.h, and isnan


  • Subject: Re: cmath, math.h, and isnan
  • From: Wesley Smith <email@hidden>
  • Date: Mon, 23 May 2005 15:03:29 -0700

thanks.  I found that this worked for me as well:

using namespace std;

#include "math.h"
#include <cmath>
#include <iostream>

int main()
{
 float x=sqrt((double)1);
 cout << isnan(x) << "\n";

 return isnan(x);
}

with the following compilation settings:

gcc -o main main.cpp -D_GLIBCPP_USE_C99=1 -lstdc++

wes



On 5/23/05, Tommy Nordgren <email@hidden> wrote:
> Add the following code to a custom header file:
> inline bool isNan(double x)
> {
>         return __isnand(x);
> }
>
> inline bool isNan(float x)
> {
>         return __isnanf(x);
> }
>
> The function calls are used internally in these overloaded functions
> are the same as the isnan
> macro expends to.
> May 23, 2005 kl. 5:33 PM skrev Wesley Smith:
>
> > Hi,
> >
> > I'm trying to compile some image processing software that uses isnan.
> > I'm using gcc 3.3, so (as was pointed out earlier) the c99 extensions
> > aren't in c++ yet.  Thus, when I include on cmath I get a 'isnan'
> > undeclared error.  The same goes for when I include both cmath and
> > math.h.  When I just include math.h however isnan is defined and I can
> > compile.
> >
> > In compiling this software, I need to somehow figure out how to use
> > both the isnan from math.h and cmath for the other functions defined
> > there in the same header file but not have them conflict.  Are there
> > any compiler settings of macros that can be used to do this?
> >
> > thanks,
> > wes
> >
> > PS is this still an issue under Tiger with gcc 4.0?
> >  _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Xcode-users mailing list      (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> > email@hidden
> >
> > This email sent to email@hidden
> >
> >
> "Home is not where you are born, but where your heart finds peace" -
> Tommy Nordgren, "The dying old crone"
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >cmath, math.h, and isnan (From: Wesley Smith <email@hidden>)

  • Prev by Date: Hidden Virtual Functions
  • Next by Date: Re: How to work around this bug?
  • Previous by thread: Re: cmath, math.h, and isnan
  • Next by thread: Re: cmath, math.h, and isnan
  • Index(es):
    • Date
    • Thread