473,763 Members | 7,044 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<complex.h>

Dear C Mavens,

I am writing a Computing Prescription for CiSE on complex
arithmetic. I would like to be sure that I do not include
any gaffes about C99--especially about what is in the header
file <complex.h. I have Googled <complex.hand got about
177K hits, which I obviously do not wish to go through one
at a time. I also tried "<complex.hsour ce" but still got
10K hits.
Does anyone know where I can get a complete, definitive and
(more-or-less) standard listing of <complex.h? Thanks for
any URLs.
--
Julian V. Noble
Professor Emeritus of Physics
University of Virginia
Jul 9 '06 #1
17 3731
On 2006-07-09, Julian V. Noble <jv*@virginia.e duwrote:
Dear C Mavens,

I am writing a Computing Prescription for CiSE on complex
arithmetic. I would like to be sure that I do not include
any gaffes about C99--especially about what is in the header
file <complex.h. I have Googled <complex.hand got about
177K hits, which I obviously do not wish to go through one
at a time. I also tried "<complex.hsour ce" but still got
10K hits.

Does anyone know where I can get a complete, definitive and
(more-or-less) standard listing of <complex.h? Thanks for
any URLs.
You could try googling "C Standard Draft" to get a copy of the
latest draft (because it's free), or you could actually buy a
copy of C99. That'll give you all you need, although it will
likely be interspersed with a /lot/ of stuff you don't need.

--
Andrew Poelstra <http://www.wpsoftware. net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 9 '06 #2
"Julian V. Noble" <jv*@virginia.e duwrites:
Does anyone know where I can get a complete, definitive and
(more-or-less) standard listing of <complex.h? Thanks for
any URLs.
Buy a copy of C99 as a PDF. It is $30 from webstore.ansi.o rg.
--
"To get the best out of this book, I strongly recommend that you read it."
--Richard Heathfield
Jul 9 '06 #3

"Julian V. Noble" <jv*@virginia.e duwrote
Dear C Mavens,

I am writing a Computing Prescription for CiSE on complex
arithmetic. I would like to be sure that I do not include
any gaffes about C99--especially about what is in the header
file <complex.h. I have Googled <complex.hand got about
177K hits, which I obviously do not wish to go through one
at a time. I also tried "<complex.hsour ce" but still got
10K hits.

Does anyone know where I can get a complete, definitive and
(more-or-less) standard listing of <complex.h? Thanks for
any URLs.
Get real.
What do you expect complex.h and the library to contain?

--
Buy my book 12 Common Atheist Arguments (refuted)
$1.25 download or $7.20 paper, available www.lulu.com/bgy1mm
Jul 9 '06 #4
"Julian V. Noble" <jv*@virginia.e duwrote in message
news:e8******** **@murdoch.acc. Virginia.EDU...
Dear C Mavens,

I am writing a Computing Prescription for CiSE on complex
arithmetic. I would like to be sure that I do not include
any gaffes about C99--especially about what is in the header
file <complex.h. I have Googled <complex.hand got about
177K hits, which I obviously do not wish to go through one
at a time. I also tried "<complex.hsour ce" but still got
10K hits.

Does anyone know where I can get a complete, definitive and
(more-or-less) standard listing of <complex.h? Thanks for
any URLs.
http://www.dinkumware.com/manuals/?m...=complex2.html

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
Jul 9 '06 #5
Julian V. Noble wrote:
Dear C Mavens,

I am writing a Computing Prescription for CiSE on complex
arithmetic. I would like to be sure that I do not include
any gaffes about C99--especially about what is in the header
file <complex.h. I have Googled <complex.hand got about
177K hits, which I obviously do not wish to go through one
at a time. I also tried "<complex.hsour ce" but still got
10K hits.

Does anyone know where I can get a complete, definitive and
(more-or-less) standard listing of <complex.h? Thanks for
any URLs.
There's no such thing as a standard listing for any standard header. For one
thing, headers are not even required to be text files, they could be
integrated into the compiler.

Instead, the standard describes headers in terms of what they must provide
and what effect including them has on the program. In my copy of the draft
standard (N1124, google for it) <complex.his described in section 7.3.

You could try to use the <complex.hfro m a compiler that supports C99 and
strip out all the compiler-specific bits, but I don't know of a C99
compliant <complex.himple mentation. GCC for one does not qualify.

Personally I'd read section 7.3 of the standard and summarize that. It's
likely that not all bits will be relevant.

S.
Jul 9 '06 #6
Malcolm wrote:
"Julian V. Noble" <jv*@virginia.e duwrote
>Dear C Mavens,

I am writing a Computing Prescription for CiSE on complex
arithmetic. I would like to be sure that I do not include
any gaffes about C99--especially about what is in the header
file <complex.h. I have Googled <complex.hand got about
177K hits, which I obviously do not wish to go through one
at a time. I also tried "<complex.hsour ce" but still got
>>10K hits.
Does anyone know where I can get a complete, definitive and
(more-or-less) standard listing of <complex.h? Thanks for
any URLs.
Get real.
^^^^^^^^
Love the manners on this group!
What do you expect complex.h and the library to contain?
Well, for one I would like to see how cabs and clog are implemented.

I have already found a <complex.hwhe re cabs is done naively as

cabs(z=x+iy) = sqrt(x*x+y*y)

and this is liable to overflow when, say, x is bigger in magnitude
than the square root of the largest representable double. Not too
smart. Goldberg describes how to do it correctly and I can't imagine
why someone making a library would not follow that method.

The complex log and related functions have implicit decisions about
where the branch line is located. For example, in the version I found
(which I do not know is a Standard version--if there is one!) the
imaginary part of the log is given as atan2(x,y). This is defined
with a range -\pi to +\pi so that the branch line for the complex log
is the negative real axis, x = 0 to -\infty. This is a perfectly
acceptable choice, but not the only possible one. If a programmer
is expecting the range to be 0 to 2\pi he will have a hard-to-find
bug.

So what I was hoping to find was enough information that I could
supply caveats in my article without raising the hackles of the C
community.

--
Julian V. Noble
Professor Emeritus of Physics
University of Virginia
Jul 9 '06 #7
Ben Pfaff wrote:
"Julian V. Noble" <jv*@virginia.e duwrites:
>Does anyone know where I can get a complete, definitive and
(more-or-less) standard listing of <complex.h? Thanks for
any URLs.

Buy a copy of C99 as a PDF. It is $30 from webstore.ansi.o rg.
Thanks, but this is a one-shot, I will never have another use
for it, and no one is going to reimburse me.

--
Julian V. Noble
Professor Emeritus of Physics
University of Virginia
Jul 9 '06 #8
In article <e8**********@m urdoch.acc.Virg inia.EDU>,
Julian V. Noble <jv*@virginia.e duwrote:
>Well, for one I would like to see how cabs and clog are implemented.

I have already found a <complex.hwhe re cabs is done naively as

cabs(z=x+iy) = sqrt(x*x+y*y)
Section 7.3.4 of the C99 Standard addresses exactly this issue.
It implies, and I paraphrase, that the implementation may have
its own clever way of computing cabs, however you can tell it
to use the formula the you have cited using a preprocessor
switch as in:

#include <complex.h>
#pragma STDC CX_LIMITED_RANG E on_or_off_switc h

The default value of the switch is off. Chances are that
the formula that you found in complex.h is guarded by a
conditional test of CX_LIMITED_RANG E.
>The complex log and related functions have implicit decisions about
where the branch line is located.
The C99 Standard is explicit about the location of branch cuts.
For instance for clog it says the branch cut is along the
negative real axis. An implementation which puts the cut anywhere
else is not standard-compliant.

For further details, see the C99 Standard. You may find a printed
copy in your library. See:

http://tinyurl.com/ns9o5

--
Rouben Rostamian
Jul 9 '06 #9
Andrew Poelstra wrote:
On 2006-07-09, Julian V. Noble <jv*@virginia.e duwrote:
>Dear C Mavens,

I am writing a Computing Prescription for CiSE on complex
arithmetic. I would like to be sure that I do not include
any gaffes about C99--especially about what is in the header
file <complex.h. I have Googled <complex.hand got about
177K hits, which I obviously do not wish to go through one
at a time. I also tried "<complex.hsour ce" but still got
>>10K hits.
Does anyone know where I can get a complete, definitive and
(more-or-less) standard listing of <complex.h? Thanks for
any URLs.

You could try googling "C Standard Draft" to get a copy of the
latest draft (because it's free), or you could actually buy a
copy of C99. That'll give you all you need, although it will
likely be interspersed with a /lot/ of stuff you don't need.
Thanks a lot. This was very helpful. Actually I Googled C99 Standard
Draft and got WG14N1124, a draft of 2005-05-06. It is evidently
aware of the problems of overflow and branch cut location that I
cite elsewhere in this thread. Sadly, the implementer(s) of the
versions of <complex.htha t I have seen so far have not seemed
to keep the Standard's advice in mind.

--
Julian V. Noble
Professor Emeritus of Physics
University of Virginia
Jul 9 '06 #10

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

Similar topics

2
3231
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are writing one object in C# which will take the entire table tag contents and renders. Ie., we need to pass "<table>………… <thead>……</thead>. <tr>.<td> <td>..<tr>.<td> <td> </table>" content to
2
10568
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script type="text/javascript"> <!]> </script> <script type="text/javascript"
2
1762
by: Peng Yu | last post by:
http://www.digitalmars.com/rtl/complex.html The above the specification of complex.h, but it seem that g++(3.3) hasn't fully support it yet. I wonder where I can find the specifications of complex.h supported by old version g++ (say 2.95.4). Peng
7
4137
by: Don Tucker | last post by:
Hello, I have the following test program that I can compile with gcc, but when I try to compile with the portland group compiler, pgcc, I get a stream of errors. #include <stdio.h> #include <complex.h> int main(int argc, char **argv){ complex double a={2.3+1.4*_Complex_I}; printf("a=%lf + i%lf\n",creal(a),cimag(a));
2
9790
by: Arvid Requate | last post by:
Hello, I'd like to understand why the following code does not compile. It looks like a strangeness in connection with overload resolution for the <complex> header: The conversion operator double() of class B is called for the member complex::operator*=(double) as expected, but not for operator*(complex, double). The effect is, that the template matching (or overload resolution)
3
3551
by: Klaas Vantournhout | last post by:
Hi, I am using CLAPACK to do lots of matrix operations, but this is done on complex matrices. There I also need to work with normal complex operators, I use also the standard complex library. Unfortunately this one conflicts with some stuff in f2c.h needed to run CLAPACK. Examples are that f2c.h declares a variable complex that fights with everything from the standard complex header. Most errors I got rid of by dumping all the...
3
6178
by: J.M. | last post by:
I have data in a double array of length 2N, which actually represents complex numbers with real and imaginary parts interlaced. In other words, elements in this array with even indices represents the real part of a complex number, elements with odd indices represent the imaginary part. I actually need an array of length N of type complex<double>. Obviously, I could copy the data and destroy the first array, but this is an expensive option....
3
3381
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt, &gt ,&ltCompany&gt to display '<', '>' and '<Company>' respectively. But is there any freeware code available which could implement the above functionality without having to use &gt,&lt and such stuff???
5
6054
by: jeremit0 | last post by:
I'm trying to sort a vector<complex<double and can't figure it out. I recognize the problem is that there isn't a default operator< for complex data types. I have written my own operator and can use it, but std::sort doesn't seem to find it. I have copied a very simple example below. Everything compiles just fine when the line with std::sort function is commented out, but with that line included a whole slew of errors are given like: ...
0
9563
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
10144
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
8821
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
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
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
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.