473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

operations on complex numbers in C99

I understand that C99 supports a complex type and complex
arithmetic. There is nothing about it in the FAQ and online
searches turned up very little except synopses. Can anyone point
me toward sources or give examples which show how to:

-declare a complex variable
-assign the real and imaginary parts
-perform the basic +,-,*,/ operations on complex numbers

Thanks,
David
Aug 5 '07 #1
27 2532
David Marsh wrote:
I understand that C99 supports a complex type and complex arithmetic.
There is nothing about it in the FAQ and online searches turned up very
little except synopses. Can anyone point me toward sources or give
examples which show how to:

-declare a complex variable
-assign the real and imaginary parts
-perform the basic +,-,*,/ operations on complex numbers
The only examples I have seen are in Annex G of the standard, not the
best (being in standards speak!), but they should be enough to get you
going.

--
Ian Collins.
Aug 6 '07 #2
David Marsh <dm****@mail.comwrites:
I understand that C99 supports a complex type and complex
arithmetic. There is nothing about it in the FAQ and online searches
turned up very little except synopses. Can anyone point me toward
sources or give examples which show how to:

-declare a complex variable
-assign the real and imaginary parts
-perform the basic +,-,*,/ operations on complex numbers
The latest draft of the standard is
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf>.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 6 '07 #3
David Marsh wrote:
>
I understand that C99 supports a complex type and complex
arithmetic. There is nothing about it in the FAQ and online
searches turned up very little except synopses. Can anyone point
me toward sources or give examples which show how to:

-declare a complex variable
-assign the real and imaginary parts
-perform the basic +,-,*,/ operations on complex numbers
Try N1124 and/or N869. You can get N869 in BZ2'd text form from:

<http://cbfalconer.home.att.net/download/>

--
"Vista is finally secure from hacking. No one is going to 'hack'
the product activation and try and steal the o/s. Anyone smart
enough to do so is also smart enough not to want to bother."

--
Posted via a free Usenet account from http://www.teranews.com

Aug 6 '07 #4
Ian Collins wrote:
David Marsh wrote:
>>I understand that C99 supports a complex type and complex arithmetic.
There is nothing about it in the FAQ and online searches turned up very
little except synopses. Can anyone point me toward sources or give
examples which show how to:

-declare a complex variable
-assign the real and imaginary parts
-perform the basic +,-,*,/ operations on complex numbers

The only examples I have seen are in Annex G of the standard, not the
best (being in standards speak!), but they should be enough to get you
going.
Sheesh! Much easier to write my own library than to make sense of
that gobbledygook. But thanks anyway.

David
Aug 6 '07 #5
David Marsh wrote:
I understand that C99 supports a complex type and complex arithmetic.
There is nothing about it in the FAQ and online searches turned up very
little except synopses. Can anyone point me toward sources or give
examples which show how to:

-declare a complex variable
double _Complex myvar = 5.778 + 45.87*I;
(standard notation)

Some compilers like lcc-win32 or gcc use
double _Complex myvar = 5.778 + 45.87i;
but that is not standard.
-assign the real and imaginary parts
creal(myvar)=8.0;
cimag(myvar)=6.9;
-perform the basic +,-,*,/ operations on complex numbers
(myvar+2)/(myvar-4)

Nothing special
>
Thanks,
David
Aug 6 '07 #6
David Marsh wrote:
Ian Collins wrote:
>David Marsh wrote:
>>I understand that C99 supports a complex type and complex arithmetic.
There is nothing about it in the FAQ and online searches turned up very
little except synopses. Can anyone point me toward sources or give
examples which show how to:

-declare a complex variable
-assign the real and imaginary parts
-perform the basic +,-,*,/ operations on complex numbers

The only examples I have seen are in Annex G of the standard, not the
best (being in standards speak!), but they should be enough to get you
going.

Sheesh! Much easier to write my own library than to make sense of that
gobbledygook. But thanks anyway.

David
See my answer elsethread. It is very easy.
Aug 6 '07 #7
jacob navia wrote:
David Marsh wrote:
>I understand that C99 supports a complex type and complex arithmetic.
There is nothing about it in the FAQ and online searches turned up
very little except synopses. Can anyone point me toward sources or
give examples which show how to:

-declare a complex variable


double _Complex myvar = 5.778 + 45.87*I;
(standard notation)

Some compilers like lcc-win32 or gcc use
double _Complex myvar = 5.778 + 45.87i;
but that is not standard.
>-assign the real and imaginary parts


creal(myvar)=8.0;
cimag(myvar)=6.9;
>-perform the basic +,-,*,/ operations on complex numbers


(myvar+2)/(myvar-4)

Nothing special
Thanks, Jacob, but I'm having a problem with the assignments
using creal() and cimag(). It works OK if the commented out lines
are used instead. What am I doing wrong?

David

#include <stdio.h>
#include <complex.h>

int main(void)
{
//double _Complex z1 = 1.2 + .5 * I;
//double _Complex z2, z3;
double _Complex z1, z2, z3;

creal(z1) = 1.2; /* error */
cimag(z1) = .5; /* error */
z2 = csqrt(z1);
z3 = z1 + z2;
printf("sqrt = %g %gi\n", creal(z2), cimag(z2));
printf("z1+z2 = %g %gi\n", creal(z3), cimag(z3));

return 0;
}

C:\WINDOWS\Desktop\data>lcc cxtest.c
Error cxtest.c: 10 the left hand side of the assignment can't be
assigned to
Error cxtest.c: 11 the left hand side of the assignment can't be
assigned to
2 errors, 0 warnings
Aug 6 '07 #8
On Mon, 06 Aug 2007 16:00:22 +0200, jacob navia wrote:
David Marsh wrote:
>I understand that C99 supports a complex type and complex arithmetic.
There is nothing about it in the FAQ and online searches turned up very
little except synopses. Can anyone point me toward sources or give
examples which show how to:

-declare a complex variable

double _Complex myvar = 5.778 + 45.87*I;
(standard notation)
<snip>
>-assign the real and imaginary parts

creal(myvar)=8.0;
cimag(myvar)=6.9;
I don't understand the last two. Isn't creal a function returning a
double? How can that yield an lvalue?.
To set just the real part of myvar, wouldn't you have to write something
like
myvar = 8.0 + cimag(myvar)*I;
?
(For what its worth I much prefer gcc's __real__ and __imag__ operators;
with them you can write
__real__ myvar = 0.0;
)
Aug 6 '07 #9
jacob navia <ja***@jacob.remcomp.frwrites:
David Marsh wrote:
>I understand that C99 supports a complex type and complex
arithmetic. There is nothing about it in the FAQ and online searches
turned up very little except synopses. Can anyone point me toward
sources or give examples which show how to:
-declare a complex variable

double _Complex myvar = 5.778 + 45.87*I;
(standard notation)
If you have '#include <complex.h>' (which is required for 'I' anyway),
you can use 'complex' rather than '_Complex'.
Some compilers like lcc-win32 or gcc use
double _Complex myvar = 5.778 + 45.87i;
but that is not standard.
and is therefore irrelevant unless you want to make your code
gratuitously non-portable.
>-assign the real and imaginary parts

creal(myvar)=8.0;
cimag(myvar)=6.9;
creal() and cimag() are functions, which therefore do not yield
lvalues. You can't assign to them.
>-perform the basic +,-,*,/ operations on complex numbers

(myvar+2)/(myvar-4)
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 6 '07 #10
On Aug 7, 9:59 am, Keith Thompson <ks...@mib.orgwrote:
jacob navia <ja...@jacob.remcomp.frwrites:
Some compilers like lcc-win32 or gcc use
double _Complex myvar = 5.778 + 45.87i;
but that is not standard.

and is therefore irrelevant unless you want to make your code
gratuitously non-portable.
It's useful to know this sort of thing, for when
you have to maintain someone else's code.
Aug 6 '07 #11
Old Wolf <ol*****@inspire.net.nzwrites:
On Aug 7, 9:59 am, Keith Thompson <ks...@mib.orgwrote:
>jacob navia <ja...@jacob.remcomp.frwrites:
Some compilers like lcc-win32 or gcc use
double _Complex myvar = 5.778 + 45.87i;
but that is not standard.

and is therefore irrelevant unless you want to make your code
gratuitously non-portable.

It's useful to know this sort of thing, for when
you have to maintain someone else's code.
A fair point. It's pretty obvious what '5.778 + 45.87i' means, but I
suppose not everyone would recognize that it's an extension.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 7 '07 #12
David Marsh wrote:
jacob navia wrote:
>David Marsh wrote:
>>I understand that C99 supports a complex type and complex arithmetic.
There is nothing about it in the FAQ and online searches turned up
very little except synopses. Can anyone point me toward sources or
give examples which show how to:

-declare a complex variable


double _Complex myvar = 5.778 + 45.87*I;
(standard notation)

Some compilers like lcc-win32 or gcc use
double _Complex myvar = 5.778 + 45.87i;
but that is not standard.
>>-assign the real and imaginary parts


creal(myvar)=8.0;
cimag(myvar)=6.9;
>>-perform the basic +,-,*,/ operations on complex numbers


(myvar+2)/(myvar-4)

Nothing special

Thanks, Jacob, but I'm having a problem with the assignments using
creal() and cimag(). It works OK if the commented out lines are used
instead. What am I doing wrong?

David

#include <stdio.h>
#include <complex.h>

int main(void)
{
//double _Complex z1 = 1.2 + .5 * I;
//double _Complex z2, z3;
double _Complex z1, z2, z3;

creal(z1) = 1.2; /* error */
cimag(z1) = .5; /* error */
z2 = csqrt(z1);
z3 = z1 + z2;
printf("sqrt = %g %gi\n", creal(z2), cimag(z2));
printf("z1+z2 = %g %gi\n", creal(z3), cimag(z3));

return 0;
}

C:\WINDOWS\Desktop\data>lcc cxtest.c
Error cxtest.c: 10 the left hand side of the assignment can't be
assigned to
Error cxtest.c: 11 the left hand side of the assignment can't be
assigned to
2 errors, 0 warnings

The correct syntax must be:

z1 = 1.2 + cimag(z1)*I;
Aug 7 '07 #13
in comp.lang.c i read:
>creal() and cimag() are functions, which therefore do not yield
lvalues. You can't assign to them.
that is not a general restriction on functions, which may certainly return
a modifiable lvalue. though creal and cimag do not.

--
a signature
Aug 8 '07 #14
On Aug 8, 10:35 am, those who know me have no need of my name <not-a-
real-addr...@usa.netwrote:
in comp.lang.c i read:
creal() and cimag() are functions, which therefore do not yield
lvalues. You can't assign to them.

that is not a general restriction on functions, which may certainly return
a modifiable lvalue.
Can you provide such an example?

Robert Gamble

Aug 8 '07 #15
Robert Gamble said:
On Aug 8, 10:35 am, those who know me have no need of my name <not-a-
real-addr...@usa.netwrote:
>in comp.lang.c i read:
>creal() and cimag() are functions, which therefore do not yield
lvalues. You can't assign to them.

that is not a general restriction on functions, which may certainly
return a modifiable lvalue.

Can you provide such an example?
#include <stdio.h>

char *foo(char *s)
{
printf("%s\n", s);
return s;
}

int main(void)
{
char array_of_modifiable_lvalues[] = "Hello World";
*foo(array_of_modifiable_lvalues) = 'C';
puts(array_of_modifiable_lvalues);
return 0;
}

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Aug 8 '07 #16
In article <Lo******************************@bt.com>,
Richard Heathfield <rj*@see.sig.invalidwrote:
>>creal() and cimag() are functions, which therefore do not yield
lvalues. You can't assign to them.
>>that is not a general restriction on functions, which may certainly
return a modifiable lvalue.
>Can you provide such an example?
>char *foo(char *s)
{
printf("%s\n", s);
return s;
}
The value returned by foo() is a pointer to a modifiable lvalue, not a
modifiable lvalue.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Aug 8 '07 #17
Richard Heathfield wrote:
Robert Gamble said:
>On Aug 8, 10:35 am, those who know me have no need of my name <not-a-
real-addr...@usa.netwrote:
>>in comp.lang.c i read:

creal() and cimag() are functions, which therefore do not yield
lvalues. You can't assign to them.

that is not a general restriction on functions, which may certainly
return a modifiable lvalue.

Can you provide such an example?

#include <stdio.h>

char *foo(char *s)
{
printf("%s\n", s);
return s;
}

int main(void)
{
char array_of_modifiable_lvalues[] = "Hello World";
*foo(array_of_modifiable_lvalues) = 'C';
puts(array_of_modifiable_lvalues);
return 0;
}
foo does not return a lvalue, especially a modifiable one. It returns a
value ("rvalue") of type pointer to char. You can use this value to
construct a lvalue, but if that is good enough to claim the function itself
returns a lvalue, what's preventing foo in

int foo(void) {
return 0;
}
int main(void) {
int arr[] = { 1 };
arr[foo()] = 0;
return arr[0];
}

from being considered as returning a lvalue?
Aug 8 '07 #18
Richard Tobin said:
In article <Lo******************************@bt.com>,
Richard Heathfield <rj*@see.sig.invalidwrote:
>>>creal() and cimag() are functions, which therefore do not yield
lvalues. You can't assign to them.
>>>that is not a general restriction on functions, which may certainly
return a modifiable lvalue.
>>Can you provide such an example?
>>char *foo(char *s)
{
printf("%s\n", s);
return s;
}

The value returned by foo() is a pointer to a modifiable lvalue, not a
modifiable lvalue.
Good point. I cannot, then, see any way that a function may return a
modifiable lvalue. I await education with eager delight.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Aug 8 '07 #19
On Aug 8, 12:24 pm, Richard Heathfield <r...@see.sig.invalidwrote:
Robert Gamble said:
On Aug 8, 10:35 am, those who know me have no need of my name <not-a-
real-addr...@usa.netwrote:
in comp.lang.c i read:
creal() and cimag() are functions, which therefore do not yield
lvalues. You can't assign to them.
that is not a general restriction on functions, which may certainly
return a modifiable lvalue.
Can you provide such an example?

#include <stdio.h>

char *foo(char *s)
{
printf("%s\n", s);
return s;

}

int main(void)
{
char array_of_modifiable_lvalues[] = "Hello World";
*foo(array_of_modifiable_lvalues) = 'C';
puts(array_of_modifiable_lvalues);
return 0;

}
As I fully suspect you already know, foo does not return a modifiable
lvalue, it returns an rvalue which when dereferenced produces an
lvalue.

Robert Gamble

Aug 8 '07 #20
On Aug 8, 12:48 pm, Richard Heathfield <r...@see.sig.invalidwrote:
Richard Tobin said:
In article <LoqdncSPdoMrcCTbnZ2dnUVZ8s3in...@bt.com>,
Richard Heathfield <r...@see.sig.invalidwrote:
>>creal() and cimag() are functions, which therefore do not yield
lvalues. You can't assign to them.
>>that is not a general restriction on functions, which may certainly
return a modifiable lvalue.
>Can you provide such an example?
>char *foo(char *s)
{
printf("%s\n", s);
return s;
}
The value returned by foo() is a pointer to a modifiable lvalue, not a
modifiable lvalue.

Good point. I cannot, then, see any way that a function may return a
modifiable lvalue.
It cannot, functions calls evaluate either to void or rvalue
expressions, that was my point.

Robert Gamble

Aug 8 '07 #21
those who know me have no need of my name <no****************@usa.netwrites:
in comp.lang.c i read:
>>creal() and cimag() are functions, which therefore do not yield
lvalues. You can't assign to them.

that is not a general restriction on functions, which may certainly return
a modifiable lvalue. though creal and cimag do not.
I wrote the quoted text ("creal() and cimag() are functions, ...").
Please don't snip attribution lines.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 8 '07 #22
In article <11*********************@w3g2000hsg.googlegroups.c om>,
Robert Gamble <rg*******@gmail.comwrote:
>Good point. I cannot, then, see any way that a function may return a
modifiable lvalue.
>It cannot, functions calls evaluate either to void or rvalue
expressions, that was my point.
I can't see any way that you can write a function returning a
modifiable lvalue (or any lvalue at all), but that doesn't mean that a
standard library function couldn't be defined to return one.

-- Richard

--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Aug 8 '07 #23
ri*****@cogsci.ed.ac.uk (Richard Tobin) writes:
In article <11*********************@w3g2000hsg.googlegroups.c om>,
Robert Gamble <rg*******@gmail.comwrote:
>>Good point. I cannot, then, see any way that a function may return a
modifiable lvalue.
>>It cannot, functions calls evaluate either to void or rvalue
expressions, that was my point.

I can't see any way that you can write a function returning a
modifiable lvalue (or any lvalue at all), but that doesn't mean that a
standard library function couldn't be defined to return one.
Except that no standard library function is defined to return an
lvalue.

I suppose, theoretically, that such a function could be defined in a
future version of the standard, but I sincerely hope that doesn't
happen (unless a mechanism is added to allow user-defined functions to
return lvalues).

<OT>Perhaps the OP who claimed that functions can return modifiable
lvalues was thinking of C++?</OT>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 8 '07 #24
In article <ln************@nuthaus.mib.org>,
Keith Thompson <ks***@mib.orgwrote:
>I can't see any way that you can write a function returning a
modifiable lvalue (or any lvalue at all), but that doesn't mean that a
standard library function couldn't be defined to return one.
>Except that no standard library function is defined to return an
lvalue.
Right, but the example that started this was just the sort of thing
the might plausibly be made to do so:

creal(myvar)=8.0;

One can imagine that being implemented as a macro in such a way that
it *would* work, for example

#define creal(x) ((x)._realpart)

which would make it natural to wish for a function to be able to do
the same.

Of course, it would be simpler to standardise such a thing it by
requiring it to be a macro, and allowing the macro to use some kind of
implementation-defined magic function if it wished to (errno is an
existing example, I think).

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Aug 8 '07 #25
ri*****@cogsci.ed.ac.uk (Richard Tobin) writes:
In article <ln************@nuthaus.mib.org>,
Keith Thompson <ks***@mib.orgwrote:
>>I can't see any way that you can write a function returning a
modifiable lvalue (or any lvalue at all), but that doesn't mean that a
standard library function couldn't be defined to return one.
>>Except that no standard library function is defined to return an
lvalue.

Right, but the example that started this was just the sort of thing
the might plausibly be made to do so:

creal(myvar)=8.0;

One can imagine that being implemented as a macro in such a way that
it *would* work, for example

#define creal(x) ((x)._realpart)

which would make it natural to wish for a function to be able to do
the same.

Of course, it would be simpler to standardise such a thing it by
requiring it to be a macro, and allowing the macro to use some kind of
implementation-defined magic function if it wished to (errno is an
existing example, I think).
Exactly. Making it a macro would make sense (and I'd argue for
calling it CREAL rather than creal). Making it a "function" that
behaves in a way that no user-defined function can possibly behave
would be silly.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 9 '07 #26
On Wed, 08 Aug 2007 23:38:45 +0000, Richard Tobin wrote:
In article <ln************@nuthaus.mib.org>,
Keith Thompson <ks***@mib.orgwrote:
>>I can't see any way that you can write a function returning a
modifiable lvalue (or any lvalue at all), but that doesn't mean that a
standard library function couldn't be defined to return one.
>>Except that no standard library function is defined to return an
lvalue.

Right, but the example that started this was just the sort of thing
the might plausibly be made to do so:

creal(myvar)=8.0;
Where will we stop? What about atan(myvar) = 1 to set myvar to
tan(1)? :-)
One can imagine that being implemented as a macro in such a way that
it *would* work, for example

#define creal(x) ((x)._realpart)

which would make it natural to wish for a function to be able to do
the same.
That would sound great, but for consistency with the rest of the
language I'd prefer setreal(z, x).
Much like ferror() which doesn't return a lvalue (but, depending
on how the FILE object is made, it could be very straightforward
to write a macro which does), and we have to use clearerr() to set
it to zero (and have no way to set it to one).
Of course, it would be simpler to standardise such a thing it by
requiring it to be a macro, and allowing the macro to use some kind of
implementation-defined magic function if it wished to (errno is an
existing example, I think).

-- Richard
--
Army1987 (Replace "NOSPAM" with "email")
No-one ever won a game by resigning. -- S. Tartakower

Aug 9 '07 #27
Richard Tobin wrote:
In article <ln************@nuthaus.mib.org>,
Keith Thompson <ks***@mib.orgwrote:
>>I can't see any way that you can write a function returning a
modifiable lvalue (or any lvalue at all), but that doesn't mean that a
standard library function couldn't be defined to return one.
>Except that no standard library function is defined to return an
lvalue.

Right, but the example that started this was just the sort of thing
the might plausibly be made to do so:

creal(myvar)=8.0;

One can imagine that being implemented as a macro in such a way that
it *would* work, for example

#define creal(x) ((x)._realpart)

which would make it natural to wish for a function to be able to do
the same.
This is EXACTLY how it is implemented in lcc-win32.
This makes access to the parts of a complex number VERY
efficient.

The correct way is it however:

double _Complex z1;

....

z1 = 22.0+cimag(z1)*I; // Sets the real part to 22
or
z1 = creal(z1)+22*I; // Sets the imaginary part to 22

Of course, it would be simpler to standardise such a thing it by
requiring it to be a macro, and allowing the macro to use some kind of
implementation-defined magic function if it wished to (errno is an
existing example, I think).

-- Richard
Aug 9 '07 #28

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

Similar topics

21
by: Blair | last post by:
could someone PLEASE tell me why this doesn't work... ----------------------------------------- #include <complex> using namespace std; typedef complex<long double> cld; void main() { cld...
17
by: Chris Travers | last post by:
Hi all; I just made an interesting discovery. Not sure if it is a good thing or not, and using it certainly breakes first normal form.... Not even sure if it really works. However, as I am...
6
by: gc | last post by:
Hi, Why didn't the committee propose a new type for complex numbers with integer components? thanks, gc
1
by: seia0106 | last post by:
Hello, I have an array X=, whose even and odd indices should represent real and imaginary parts of complex numbers. This I want to use in a routine that uses the typedef double Cx; for storing...
3
by: Russ | last post by:
I'd like to get output formatting for my own classes that mimics the built-in output formatting. For example, >>> x = 4.54 >>> print "%4.2f" % x 4.54 In other words, if I substitute a class...
7
by: schaefer.mp | last post by:
To compute the absolute value of a negative base raised to a fractional exponent such as: z = (-3)^4.5 you can compute the real and imaginary parts and then convert to the polar form to get...
16
by: Gianmaria Iaculo - NVENTA | last post by:
Hi there, I'm so new to python (coming from .net so excuse me for the stupid question) and i'm tring to do a very simple thing,with bytes. My problem is this: i've a byte that naturally is...
25
by: jacob navia | last post by:
The C99 standard forgot to define the printf equivalent for complex numbers Since I am revising the lcc-win implementation of complex numbers I decided to fill this hole with "Z" for...
9
by: void main | last post by:
I'm rather new to complex numbers in C and was wondering, how do I initialize a complex variable properly if the imaginary part is 0. I tried -------- #include <complex.h> float complex c...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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...
0
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,...
0
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...

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.