Options: Use Forum View Use Monospaced Font Show Text Part by Default Show All Mail Headers Message: [<< First] [< Prev] [Next >] [Last >>] Topic: [<< First] [< Prev] [Next >] [Last >>] Author: [<< First] [< Prev] [Next >] [Last >>]

 Subject: Re: Proposal : For-Loop Iteration for Real Type From: Toshitaka KUMANO <[log in to unmask]> Reply To: Toshitaka KUMANO <[log in to unmask]> Date: Wed, 5 Sep 2001 10:24:14 +0900 Content-Type: text/plain Parts/Attachments: text/plain (80 lines)
```Dear Jacob,

Sorry to respond late.

Jacob Sparre Andersen wrote:
>
> Toshitaka:
>
> > Jacob Sparre Andersen wrote:
> > > I think for loops on floating point types is a mistake,
> > > since the step size isn't constant.
> >
> > Constancy is desirable here ?
>
> I think so. Can you come up with any uses, where a
> non-constant step size would be acceptable?

As I wrote in my first proposal,

Toshitaka KUMANO wrote:
>   -  The extension helps programmer, typically, to write some rigorous
>      test driver for numeric computation, or so.

What is needed here is every floating numbers in some range
in THE implementation.
Imagin to test some numerical function in which various computation
including convergence (unhappily divergence).

In the situation, the structure

for X in Float in 1.0 .. 2.0 loop
for Y in Float in 1.0 .. 2.0 loop
Answer := Function_To_Be_Testd (X, Y);
end loop;
end loop;

Of course, floatings are implemetation dependent.
There are IEEE754, or of 16 base mantissa (like IBM or UYK) etc.

However, what to be needed here is to test the function
in all possible numbers in THE implementation dependent floating.

Adding to that, floatings is not relevant to constancy inherently.
And I think the word "iteration" does not indicate constancy, at least,
directly.

"iteration" in this domain means just to "visit every possible elements".

We can re-view here the syntax "for R in Float range 1.0 .. 2.0"
mathematically like "for all R of Float in the closed interval [1.0, 2.0]
(in THE implemenation)".

This view is consistent also with discrete for-loop and
also with fixed for-loop.

> > What do you think about enumeration, whose
> > representations are specified as sparse ones ?
> >
> >  # type E is (A, B, C, D);
> >  # for E use (A => 0, B => 10, C => 100, D => 1_000);
>
> No problem. There is a difference between the representation
> and the "abstract" view.

My interrogation was just to know if you seek rigorous (numerical)
constancy.

I agree perfectly with your "abstact" view.

And I consider this view is not inconsistent with
"for all E in Enumeration range X .. Y", is it ?

Regards,
--
------------------------------------------------------------------------