e to the i pi

C

CBFalconer

Keith said:
.... snip ...


That differed from what?
From any other stdbool.h, I assume. This is probably connected
with the fact that stdbool.h is completely described in N869,
leaving nothing to the imagination. <Append something about female
garments here.>

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
 
L

Lane Straatman

Glenn Hutchings said:
For even more fun, try computing i ^ i. Betcha didn't see that
coming!
We know that it exists as a complex that C can calculate from first
principles. LS
 
L

Lane Straatman

Richard Heathfield said:
Lane Straatman said:

Actually, Ian is a very very very clever man, a fine fellow, an
excellent host, a talented musician, a superb programmer, and a quite
astounding linguist, but it has to be said, when all's said and done,
that he's not a doctor. I know the book says he is - at least three
times - but the book is wrong. That's probably my fault, because I
think I just kind of assumed he had a doctorate when I was setting up
the team, and it turns out he hasn't. If ever there were a failure of
the British education system, it is this: that it does not regard Ian
as a doctor. Having said that, I'm now going to stop making a fuss
about it. Instead, I would like to award Ian an honorary doctorate from
the University of Common Sense.
ABD is a common affliction in the US (All But Disseration). If you make it
sound really serious,
Ian's expansion of e, however, was not done via calls to atan(), which
is what Tim Prince was talking about. atan() returns a double, and a
double cannot store an irrational number precisely. A circle can, but a
double can't.
You can re-topologize and get a line from whatever circle you created* **, a
line in which, you claim, "almost all" numbers are absent. If you think
almost all numbers are absent in C's ability to work with, say, the segment
[-1.01, -.99], you're a different kind of cat than I.

Do you honestly believe that 42 * arctan(1.0) is in Q?
 
L

Lane Straatman

I meant to differ from itself. Another example of this is iso646.h .
with the fact that stdbool.h is completely described in N869,
leaving nothing to the imagination. <Append something about female
garments here.>
Carla left her purse.
The heel on Jenn's boot was 4 inches.
Misty was outlaw. LS
 
K

Keith Thompson

CBFalconer said:
with the fact that stdbool.h is completely described in N869,
leaving nothing to the imagination. <Append something about female
garments here.>

The standard completely describes the visible declarations, but not
the whole file. For example, the version provided on one Linux system
I use has a large comment block, include guards using the symbol
"_STDBOOL_H", and a test for __cplusplus (supporting <stdbool.h> in
C++ is a gcc extension).

But it's true that copying <stdbool.h> from one implementation to
another is less likely to cause problems than most other predefined
headers.
 
K

Keith Thompson

Lane Straatman said:
Ian's expansion of e, however, was not done via calls to atan(), which
is what Tim Prince was talking about. atan() returns a double, and a
double cannot store an irrational number precisely. A circle can, but a
double can't.
You can re-topologize and get a line from whatever circle you created* **, a
line in which, you claim, "almost all" numbers are absent. If you think
almost all numbers are absent in C's ability to work with, say, the segment
[-1.01, -.99], you're a different kind of cat than I.

Different in that he knows what he's talking about.

A double is typically 64 bits. That means it can represent at most
2**64 distinct values. Some small subset of those values will be in
the range [-1.01, -.99], a range that includes infinitely many real
numbers. Yes, almost all numbers are absent in C's ability to work
with, say, the segment [-1.01, -.99].
Do you honestly believe that 42 * arctan(1.0) is in Q?

Q is the set of rational numbers, yes? (Please don't assume everone
here is familiar with that particular mathematical notation.)

If by "42 * arctan(1.0)" you mean the result of the mathematical
formula over real numbers, then no, the result is not rational; in
fact, it's trancendental (10.5 * pi).

If instead you're referring to the result of the C expression
"42 * atan(1.0)" (the function declared in <math.h> is "atan", not
"arctan"), then yes, that result is rational. It is a value of type
double, which is a floating-point type whose representation is a
finite number of bits. It can *only* represent rational numbers. In
fact, it can only represent a tiny subset of the rational numbers.
(In a typical implementation, all representable numbers are integer
multiples of a power of 2.)

C floating-point types cannot represent irrational numbers. They are
not mathematical real numbers; they are only a discrete approximation,
good enough for many purposes.

You might want to look up Goldberg's "What Every Computer Scientist
Should Know About Floating-Point Arithmetic".
 
R

Richard Heathfield

Malcolm McLean said:

[MS] do offer a free compiler. It looks pretty horrid, but at least it
compiled "Hello World" - not without five minutes tweaking to get rid
of a file called stdafx.h it insisted on adding.

Anyway I have registered and agreed not to distribute any programs
compiled with it as open source, etc, etc, etc. I've no real choice.

Yes, you do. Your original problem - software you purchased failing to
run on your new machine - was caused by Microsoft. Your fix, supplied
by Microsoft, is unsatisfactorily restrictive. You have no reasonable
assurance that Microsoft isn't going to cause you even more problems in
the future. It seems to me that the obvious thing to do is knock
Microsoft out of the loop, even if that means spending some time
porting your stuff to a more sensible platform.
A computer isn't a computer without a programming environment - it's
just a glorified typewriter.

A compiler whose licence agreement requires you not to allow your users
access to source code is not a compiler - it's a prison.
 
R

Richard Heathfield

Lane Straatman said:
If you
think almost all numbers are absent in C's ability to work with, say,
the segment
[-1.01, -.99], you're a different kind of cat than I.

Miaow. C programs are capable of representing almost none of the numbers
in the that range.
Do you honestly believe that 42 * arctan(1.0) is in Q?

If you mean 42 * atan(1.0), then yes, I do.
 
S

santosh

Malcolm said:
"Richard Heathfield" <[email protected]> wrote in message
They do offer a free compiler. It looks pretty horrid, but at least it
compiled "Hello World" - not without five minutes tweaking to get rid of a
file called stdafx.h it insisted on adding.

Anyway I have registered and agreed not to distribute any programs compiled
with it as open source, etc, etc, etc. I've no real choice. A computer isn't
a computer without a programming environment - it's just a glorified
typewriter.

Why don't you purchase a copy of Visual Studio (TM)? Then you can
distribute your applications with source.
 
G

Glenn Hutchings

We know that it exists as a complex that C can calculate from first
principles. LS

Well duh. But my point is, what do you think the answer will be?

Glenn
 
R

Richard Heathfield

santosh said:
Why don't you purchase a copy of Visual Studio (TM)? Then you can
distribute your applications with source.

Let's get this straight. He spent money on a Microsoft product (Visual
C++). He then spent some more money on another Microsoft product
(Vista), as a result of which his first product stopped working. Are
you really suggesting that he gives *even more* money to Microsoft, to
get back the functionality that he has *already paid for*?

Have you ever heard of the expression "throwing good money after bad"?
 
S

sjdevnull

Malcolm said:
They do offer a free compiler. It looks pretty horrid, but at least it
compiled "Hello World" - not without five minutes tweaking to get rid of a
file called stdafx.h it insisted on adding.

Anyway I have registered and agreed not to distribute any programs compiled
with it as open source, etc, etc, etc. I've no real choice. A computer isn't
a computer without a programming environment - it's just a glorified
typewriter.

Is mingw working on Vista? I've had no problems with using it on
various older Windows versions, it's free, and you can distribute open
source and other software compiled with it.
 
K

Keith Thompson

Malcolm McLean said:
Anyway I have registered and agreed not to distribute any programs compiled
with it as open source, etc, etc, etc. I've no real choice. A computer isn't
a computer without a programming environment - it's just a glorified
typewriter.

Do they *really* require you to agree to that? How can they enforce a
restriction like that? If you distribute your own source code, how
can the fact that you've fed it to their compiler affect your rights?
I suspect the situation isn't that simple.

You can always install Cygwin, which includes gcc (I'm not sure how
much support it has for Windows-specific programming, though).
 
L

Lane Straatman

Richard Heathfield said:
santosh said:
You asked it to do that.
Let's get this straight. He spent money on a Microsoft product (Visual
C++). He then spent some more money on another Microsoft product
(Vista), as a result of which his first product stopped working. Are
you really suggesting that he gives *even more* money to Microsoft, to
get back the functionality that he has *already paid for*?

Have you ever heard of the expression "throwing good money after bad"?
The money I spent to buy MVC++4 I saved from my mouth. I'm just now
retiring it after -I dunno-a decade? of service. He has no business near a
keyboard if he doesn't know how to uninstall and reinstall. And if the
registry's forked then deltree C: and move on with a re-install that every
prudent user marks well for himself. Twenty bucks a year was good money for
me. I think spending any money on a computer for this guy is bad money. He
has no real choice about distributing software, as he lacks the ability to
manipulate the dominant OS. LS
 
C

CBFalconer

Lane said:
.... snip ...

I think spending any money on a computer for this guy is bad money.
He has no real choice about distributing software, as he lacks the
ability to manipulate the dominant OS.

Dominant? The cockroach population of NYC exceeds the human
population. Does that make them dominant?

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
 
L

Lane Straatman

Glenn Hutchings said:
Well duh. But my point is, what do you think the answer will be?
#include <stdio.h>
#include <complex.h>
int main() {
long double complex z1;
z1= I;
z1 = cpow(z1, z1);
printf("%lf %lf ", z1);
return 0;}
 
L

Lane Straatman

Glenn Hutchings said:
For even more fun, try computing i ^ i. Betcha didn't see that
coming!
I stated in this thread that I wanted to take e to the i pi and get as close
as I could with it using pre-defined types. I think i^i better suits this
purpose. LS
 
K

Keith Thompson

Lane Straatman said:
#include <stdio.h>
#include <complex.h>
int main() {
long double complex z1;
z1= I;
z1 = cpow(z1, z1);
printf("%lf %lf ", z1);
return 0;}

The "%lf" format specifier is invalid. The format for double is "%f";
the format for long double is "%Lf". Some implementations may support
"%lf" as an extension.

The "%Lf" format specifier requires an argument of type long double;
two such specifiers don't magically consume a single argument of type
long double complex. (I think I've mentioned this to you before.)

Even for a short program, *please* indent your code properly; it makes
it much easier to read.

Here's a corrected and simplified version of your program:

#include <stdio.h>
#include <complex.h>
int main(void)
{
const long double complex z1 = cpowl(I, I);
printf("%Lf %Lf\n", creall(z1), cimagl(z1));
return 0;
}

and its output:

0.207880 0.000000

You can get more digits by tweaking the format specifiers.

Apparently i^i (where i is the imaginary square root of -1 and "^"
denotes exponentiation) is a real number. I'm sure there's a simple
mathematical proof of this, but I'm too lazy to track it down or
reconstruct it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top