From: Simon Wright on
Stephen Leake <stephen_leake(a)stephe-leake.org> writes:

> Whether the bug is encountered is sometimes stochastic.

In particular this can be true of race conditions.
From: Simon Wright on
"Yannick Duchêne (Hibou57)" <yannick_duchene(a)yahoo.fr> writes:

> May be possible reason is that a complex number is seen a composite
> type, and how would one fix the type of its two component ? Float ?
> Fixed ? Both the same ? Different ? And so on. Unless with a special
> ugly/heavy syntax, difficult to image a way to simply declare a
> complex type in Ada (unless you do it the C way : one type for all
> use, without constraints, and no other choices).

ARM Annex G? http://www.adaic.com/standards/05rm/html/RM-G-1.html

I'm not a mathematician (as a physicist) but I can't imagine why you
would want the two components of a complex number to have different base
types.
From: Dmitry A. Kazakov on
On Sat, 05 Jun 2010 11:24:57 +0200, Yannick Duch�ne (Hibou57) wrote:

> Le Sat, 05 Jun 2010 10:04:52 +0200, Nasser M. Abbasi <nma(a)12000.org> a
> �crit:
>>>> and in what area(s) does it excel, e.g. data processing, number
>>>> crunching, graphics, etc?
>>
>>> It is excellent in these areas, and probably in many others...
>>> _________________________________________________________
>>
>> I think the fact that complex numbers are not a build-in primitive data
>> type in Ada makes it bit harder to use for number crunching.
>>
>> Fortran, for example, had complex numbers build into the language. I
>> wonder why the orginal designers did not add complex data type to the
>> design of Ada.
>>
>> Other than that, I think Ada would be a very good choice for number
>> crunching, but from what I see, it is very little used in this area.
>>
> May be possible reason is that a complex number is seen a composite type,
> and how would one fix the type of its two component ? Float ? Fixed ? Both
> the same ? Different ? And so on. Unless with a special ugly/heavy syntax,
> difficult to image a way to simply declare a complex type in Ada (unless
> you do it the C way : one type for all use, without constraints, and no
> other choices).

Sorry guys, maybe I missed the point, but Ada does have complex types. See
ARM G.1.

As for different types of the real and imaginary parts, it would make
little or no sense because you can "rotate" numbers by multiplying them to
exp(j*angle). So the complex space must be isotropic with regard to
precision and range. This speaks for same types.

As for syntax, Ada syntax of record aggregates maps the standard
mathematical notation of, i.e. (Re, Im). Naturally Re+j*Im and Re+i*Im are
also supported since the package Complex_Types defines the constants i and
j.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
From: Yannick Duchêne (Hibou57) on
Le Sat, 05 Jun 2010 14:59:11 +0200, Dmitry A. Kazakov
<mailbox(a)dmitry-kazakov.de> a écrit:
> Sorry guys, maybe I missed the point, but Ada does have complex types.
> See
> ARM G.1.
I miss-understood the question, indeed (don't know why I had read it this
way, I had read it as if it was requesting for a type which could be
declared like range and so on)

--
There is even better than a pragma Assert: a SPARK --# check.
--# check C and WhoKnowWhat and YouKnowWho;
--# assert Ada;
-- i.e. forget about previous premises which leads to conclusion
-- and start with new conclusion as premise.
From: Nasser M. Abbasi on
On 6/5/2010 5:59 AM, Dmitry A. Kazakov wrote:


> Sorry guys, maybe I missed the point, but Ada does have complex types. See
> ARM G.1.
>

I meant complex type in ada is not an elementary type. as in

http://www.adaic.org/standards/05rm/html/RM-3-2.html

"The elementary types are the scalar types (discrete and real) and the
access types (whose values provide access to objects or subprograms).
Discrete types are either integer types or are defined by enumeration of
their values (enumeration types). Real types are either floating point
types or fixed point types."

and

http://en.wikibooks.org/wiki/Ada_Programming/Type_System

I copied the list from above:

"Here is a broad overview of each category of types; please follow the
links for detailed explanations. Inside parenthesis there are
equivalences in C and Pascal for readers familiar with those languages."

Signed Integers (int, INTEGER)
Unsigned Integers (unsigned, CARDINAL)
unsigned they also have wrap-around functionality.
Enumerations (enum, char, bool, BOOLEAN)
Floating point (float, double, REAL)
Ordinary and Decimal Fixed Point (DECIMAL)
Arrays ( [ ], ARRAY [ ] OF, STRING )
Record (struct, class, RECORD OF)
Access (*, ^, POINTER TO)
Task & Protected (no equivalence in C or Pascal)
Interfaces (no equivalence in C or Pascal)

I do not see complex type there :)

Ofcourse, a standard generic package for complex type, I knew that.

In FORTRAN:

http://www.fortran.com/F77_std/rjcnf-4.html#sh-4

"4.1 Data Types
The six types of data are:

1. Integer
2. Real
3. Double precision
4. Complex
5. Logical
6. Character

"

So, complex is an elementary type, like an integer is.

I am learning to use complex numbers in Ada from wiki Ada book, was
looking at the examples here:

http://en.wikibooks.org/wiki/Ada_Programming/Mathematical_calculations#Complex_arithmethic

and it seem many packages need to be instantiated just to use complex
numbers.

with Ada.Text_IO.Complex_IO;
with Ada.Numerics.Generic_Complex_Types;
with Ada.Numerics.Generic_Complex_Elementary_Functions;

etc..

I just meant it seems "easier" to use complex numbers in FORTRAN than
Ada, just because one does not to do all this instantiating every where.
But I hope to learn to use complex numbers better in Ada, I have very
little experiences with this in Ada.

--Nasser