473,786 Members | 2,350 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

isnan() for complex data

Hi

Has C++ defined the function
isnan() for complex numbers?
What is the definition?

Thanks in advance
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Feb 4 '08 #1
4 4293
jacob navia wrote:
Hi

Has C++ defined the function
isnan() for complex numbers?
What is the definition?

Thanks in advance
/isnan/ is a macro in C99, still not in the current C++03 standard.

Synopsis:
#include <math.h>
int isnan(real-floating x);

--
Best Regards
Barry
Feb 4 '08 #2
Barry wrote:
jacob navia wrote:
>Hi

Has C++ defined the function
isnan() for complex numbers?
What is the definition?

Thanks in advance

/isnan/ is a macro in C99, still not in the current C++03 standard.

Synopsis:
#include <math.h>
int isnan(real-floating x);
In C99 this is ONLY defined for real types. No definition for
complex types. What is the definition in C++?

is it

insan(z) --isnan(real(z) || isnan(imag(z)

or

insan(z) --isnan(real(z) && isnan(imag(z)

???

The same problem appears for

isinf()
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Feb 4 '08 #3
jacob navia wrote:
>
In C99 this is ONLY defined for real types. No definition for
complex types. What is the definition in C++?

is it

insan(z) --isnan(real(z) || isnan(imag(z)
excuse me that should have been
insan(z) --isnan(real(z)) || isnan(imag(z))
with correctly matched parentheses!
>
or

insan(z) --isnan(real(z) && isnan(imag(z)
The same
insan(z) --isnan(real(z)) && isnan(imag(z))

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Feb 4 '08 #4
jacob navia wrote:
jacob navia wrote:
>>
In C99 this is ONLY defined for real types. No definition for
complex types. What is the definition in C++?
>insan(z) --isnan(real(z)) || isnan(imag(z))
If you want to program an "isnan" function for std::complex<T> , then I
suggest you to use the above function.

If one of the parts is an invalid real number then your whole complex
number should be invalid.

The same reasoning goes for isinf. If one of your complex numbers is
infinite, then your complex number is one of the many representations of
infinite.

Klaas
Feb 5 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1850
by: Marc te Vruchte | last post by:
Over the past years i've been in contact with the same problem a number of times, creating a graphical user interface on complex XML documents. Personally these solutions have never been satisfactory to me as a developer. I am not sure if this is caused by the way i've approached the problem or that it is the maturity of current day XML technologies. Let's say we are developing Form interfaces on complex XML documents which have a...
8
2963
by: Steve Jorgensen | last post by:
Mailing List management is a good example of a case where my conundrum arises. Say there is a m-m relationship between parties and groups - anyone can be a member of any combintation of groups. Now, let's say the user wants to be able to send mailings to people who have various combinations of membership and non-membership in those groups. Here's a medium-complex example: (Knitting Group or Macrame Group) and Active Contact and Mailing...
5
15642
by: Skybuck Flying | last post by:
Hi, I have one more remaining "problem" with compiling a unix source code for windows/visual c/c++ 6.0 What does the isnan routine do ? Documentation says it checks for NaN ? What does that mean ? What is a good replacement for Visual C/C++ 6.0 ?
4
9683
by: Pertti Martikainen | last post by:
Hi, The following lines are from my Immediate - window: dValue NaN Double.IsNaN(dValue) false I evaluate variable dValue, I get NaN but IsNaN returns
4
4552
by: siaj | last post by:
I am new to jscript.. I am trying to validate if a textbox on my ASP.NET page has numeric value.. The code I am using is function IsValidAmount() { var intTotalAmt = document.Form1.txtTotalAmt.value; If (isNaN(intAmt1)== false) {//do something} }
2
49865
by: Priya | last post by:
Halo. I am using isinf() & isnan() in my code, and i get an error error LNK2001: unresolved external symbol "int __cdecl isnan(double)" (?isnan@@YAHN@Z) my code is the implementation of LambertW function #include <math.h>
1
9516
by: perroe | last post by:
Hi I have a array of complex numbers that are stored in a simple double array. This is done since the array is part of an wrapper for an external C library, and the imaginary part of the first element, and the last element are known to be 0. I've implemented a -operator that returns a ComplexReference object that basically maps a complex<doubleinto the storage used in the array. What I would like to do is using the ComplexReference...
6
5587
by: Java script Dude | last post by:
Small glitch (IMHO) in JavaScript is related to isNaN() boolean function. If passed a null, it returns true which is incorrect. This one cause me quite a bit of grief until I detected it and was able to code around it. Anybody know the reasoning for the result being false and not true for isNaN(null). - JsD
2
1720
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Have a complex process where I need to Import a large amount of data then run some transformations on this data then import into DataBase. The transformation involves multiple fields and multiple process - so the data needs to be read in 1 record at a time then run thru the transformation that may create new data value then everything is imported into a db to store. I have multiple questions 1)we used to have an internal data structure...
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9492
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10360
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10163
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.