complex

G

gc

Hi,
Why didn't the committee propose a new type for complex numbers with
integer components?
thanks,
gc
 
A

Arthur J. O'Dwyer

Why didn't the committee propose a new type for complex numbers with
integer components?

At first glance, I would ask: What semantics would you give complex
integer division? Would the identity (a == a/b*b + a%b) still hold?

But considering that you probably *could* give a reasonable answer,
my real answer would be: What use would complex integer math be to
anyone? Complex floating arithmetic is just barely useful to a
vocal minority as it is (IMHO); I don't think anyone really cares
at all about "complex integer" arithmetic!

And if nobody cares, and nobody would use it, why bother to put it
in the Standard?

-Arthur
 
J

Jens.Toerring

gc said:
Hi,
Why didn't the committee propose a new type for complex numbers with
integer components?

Because complex numbers always have a real and imaginary part *per
definitionem* - there aren't "complex integers" and you can't do
"complex counting", so why should the people working on the standard
come up with a type of numbers that even the mathematicans never
did conceive?
Regards, Jens
--
_ _____ _____
| ||_ _||_ _| (e-mail address removed)-berlin.de
_ | | | | | |
| |_| | | | | | http://www.physik.fu-berlin.de/~toerring
\___/ens|_|homs|_|oerring
 
E

Erik Trulsson

Because complex numbers always have a real and imaginary part *per
definitionem* - there aren't "complex integers" and you can't do
"complex counting", so why should the people working on the standard
come up with a type of numbers that even the mathematicans never
did conceive?
Regards, Jens

But the mathematicians did conceive of such numbers.
Complex numbers where both the real and imaginary parts are integers
are generally known as Gaussian integers.
Some more information about Gaussian integers can be found at
http://mathworld.wolfram.com/GaussianInteger.html

It is a fairly safe assumption that if you can think of a type of
number, some mathematician has already thought about it and written a
paper about them.



The reason Gaussian integers weren't included in the standard is most
likely that they are rarely used. There is not much reason to mandate
support for a feature that only a few programs will ever have any use
for, especially since it is not too difficult to write your own
functions to handle them.

Ordinary complex numbers are used much more often, so for those it made
more sense to have them as part of the language.
 
K

Keith Thompson

Because complex numbers always have a real and imaginary part *per
definitionem* - there aren't "complex integers" and you can't do
"complex counting", so why should the people working on the standard
come up with a type of numbers that even the mathematicans never
did conceive?
Regards, Jens

Actually, complex integers are a perfectly valid mathematical concept;
they're also known as Gaussian integers. See, for example,
<http://mathworld.wolfram.com/GaussianInteger.html>.

Gaussian integers aren't directly supported in C because there isn't
much demand for them.
 
G

gc

But considering that you probably *could* give a reasonable answer,
my real answer would be: What use would complex integer math be to
anyone? Complex floating arithmetic is just barely useful to a
vocal minority as it is (IMHO); I don't think anyone really cares
at all about "complex integer" arithmetic!

Gaussian integers form an integral domain so division need have been
defined or could have been defined in a manner analogous to how the
division operator works for integers in C (the reminder theorem holds
for gaussian integers so I guess it shouldn't be a big deal, the
quotient could have been used).
And if nobody cares, and nobody would use it, why bother to put it
in the Standard?

Thats a valid point, for the sake of completeness perhaps, kindly
correct me if I am wrong but wasn't the unary + operator was
introduced for the same reason, I think hardly any coe uses the unary
+ operator. Gaussian integers would be of use for some people.
 
O

osmium

gc said:
Thats a valid point, for the sake of completeness perhaps, kindly
correct me if I am wrong but wasn't the unary + operator was
introduced for the same reason, I think hardly any coe [?] uses the unary
+ operator. Gaussian integers would be of use for some people.

The missing unary plus causes an annoying asymmetry in the syntax. That is
not the case with the integer complex deal.
 

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
474,085
Messages
2,570,597
Members
47,219
Latest member
Geraldine7

Latest Threads

Top