Re: how can I return nothing?
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Wed, 19 Sep 2007 20:02:55 -0700
richard@xxxxxxxxxxxxxxx (Richard Tobin) writes:
In article <87sl5anseq.fsf@xxxxxxxxxxxxxxxx>,
Michal Nazarewicz <mina86@xxxxxxx> wrote:
Well... i is not really sqrt(-1) since there are two complex numbers
which are not equal to one another which power of two is equal -1 and
i cannot be equal to both numbers. :P
Would you also say that 2 is not really sqrt(4), since there are
two real numbers whose square is 4 and 2 cannot be equal to both
of them?
(You do have a point though: there is no way to distinguish between
i and -i.)
Um, -i is the one with the minus sign in front of it.
Seriously, I'm not sure what you mean by "no way to distinguish". For
positive operands, only the positive square root is considered to be
*the* square root (e.g., sqrt(4.0) is 2.0, not -2.0). Similar rules
apply for negative and even complex operands.
C99 supports a complex square root function, csqrt (plus csqrtf and
csqrtl for float complex and long double complex, respectively).
C99 7.3.8.3 says:
The csqrt functions compute the complex square root of z, with a
branch cut along the negative real axis.
The csqrt functions return the complex square root value, in the
range of the right halfplane (including the imaginary axis).
Both in C and in mathematics, sqrt(-1) is i, not -i (or I as C's
<complex.h> calls it).
(See, we're topical again!.)
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <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"
.
- Follow-Ups:
- Re: how can I return nothing?
- From: Old Wolf
- Re: how can I return nothing?
- From: Richard Tobin
- Re: how can I return nothing?
- References:
- how can I return nothing?
- From: xicloid
- Re: how can I return nothing?
- From: Malcolm McLean
- Re: how can I return nothing?
- From: Keith Thompson
- Re: how can I return nothing?
- From: Michal Nazarewicz
- Re: how can I return nothing?
- From: Richard Tobin
- how can I return nothing?
- Prev by Date: Re: Struct size
- Next by Date: Re: EOF
- Previous by thread: Re: how can I return nothing?
- Next by thread: Re: how can I return nothing?
- Index(es):