473,465 Members | 4,823 Online
Bytes | Software Development & Data Engineering Community
Create 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 4265
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
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...
8
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. ...
5
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...
4
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
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 =...
2
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...
1
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...
6
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...
2
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.