This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Complex division (was Re: c/2995: __complex__ int typecasts maybe broken)


"Joseph S. Myers" <jsm28@cam.ac.uk> writes:

| On Thu, 8 May 2003, Gabriel Dos Reis wrote:
| 
| > Like Joe suggested, deprecating only the problematic operations should
| > be sufficient.  There are uses of "__complex__ integer-type" in Number
| 
| Complex integer division is problematic 

I'm not disputing that fact.  What I disagree with is the option of
deprecating __complex__ integer as a whole as a solution to the problem.

| - except that you can easily
| produce meaningful modulo and division operations in the Gaussian
| integers, the problem is defining a unique one that is sensible for C
| (still more problematic to get one that is also consistent with the
| unfortunate modulo definition for integers in C99) and sensibly
| implementable.

I would not go far as taking Gaussian Ring as The Model of division.
Just declaring the division ill-formed should be fine.

|  Complex integer multiplication is also problematic
| (overflow of intermediate expressions) until we have the facility to mark
| individual operations (generated from the multiplication) as
| overflow-defined/undefined.  You could deprecate both - but then complex
| integer operations would be of even less use. 

Just because intermediate results might overflow is not a compelling
argument for its deprecation.  Just state the algorithm of
computations and state that if any intermediate result overflow then
the result is undefined.  That does make it useful for all cases where
overflow does not occur.  This not a big deal nor the first time we
would make such requirements.

| I doubt that the built-in
| complex integer facilities are likely to be what anyone making
| mathematical use of the Gaussian integers would be likely to use.

By the same token, one can conclude that because the intermediate
results may overflow, one doubts that complex floating facilities are
likely to be what anyone making mathematic use of complex numbers
would likely to use.

For the *pratical* (not ideal mathematical) use, they are certainly
useful. 

| (Complex integers also require GCC to define its own ABI and debug
| representations, and I'm not aware of these being documented anywhere.  

Agreed. 

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]