From: Richard Maine on
Ronald Benedik <rbenedik(a)fsmat.htu.tuwien.ac.at> wrote:

> Once I wrote a least square program using QR decomposition
> in C. I dropped the idea of doing it in Fortran because there's
> better control of data types and subsequently
> rounding behavior in C.

Eh? I suppose you must be referring to something other than the C
standard, which I don't recall as saying anything more about about
floating-point data types or rounding issues than Fortran 77.
Traditional C is noted for its distinct lack of user control over even
such basic things as whether a function returns single or double
precision. I also suppose you must be omitting complex data type.
Although standard f77 was severely shortchanged in regards to complex
type, it wasn't as much so as the C standard of the same time frame.

If one moves to time frames a little more recent, I suppose you must
also be referring to some time prior to f90, much less f95+IEEE TR. That
would seem to rule out too recent.

All in all, I find myself at a loss to guess what you might be referring
to. For floating point numerics, I'm much more used to hearing about the
shortcommings of standard C. See NCEG (Numerical C Extensions Group),
which is specifically about addressing those shortcommings.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
From: Ronald Benedik on


"Richard Maine" <nospam(a)see.signature> schrieb im Newsbeitrag
news:1jbff4h.17lx0qbyblyomN%nospam(a)see.signature...
> Ronald Benedik <rbenedik(a)fsmat.htu.tuwien.ac.at> wrote:
>
>> Once I wrote a least square program using QR decomposition
>> in C. I dropped the idea of doing it in Fortran because there's
>> better control of data types and subsequently
>> rounding behavior in C.
>
> Eh? I suppose you must be referring to something other than the C
> standard, which I don't recall as saying anything more about about
> floating-point data types or rounding issues than Fortran 77.

> Traditional C is noted for its distinct lack of user control over even
> such basic things as whether a function returns single or double
> precision.

I refered to gcc. You must refer to the math library of C.
even my sqrt function was done in float, double or long double.

> I also suppose you must be omitting complex data type.

Thats true I programmed only only float, double or long double precision.

> Although standard f77 was severely shortchanged in regards to complex
> type, it wasn't as much so as the C standard of the same time frame.

I never used Fortran 77 but only Fortran 90 or HPF.

> If one moves to time frames a little more recent, I suppose you must
> also be referring to some time prior to f90, much less f95+IEEE TR. That
> would seem to rule out too recent.

Maybe I didn't get something about Fortran but where the
heck is the sizeof() feature in Fortran 90?. I can control
FPU and SSE register rounding mode in C. It is not possible
in Fortran 90.

> All in all, I find myself at a loss to guess what you might be referring
> to. For floating point numerics, I'm much more used to hearing about the
> shortcommings of standard C. See NCEG (Numerical C Extensions Group),
> which is specifically about addressing those shortcommings.

I see newer Fortran compilers more controlled by shell variables
what I consider a mistake.

> --
> Richard Maine | Good judgment comes from experience;
> email: last name at domain . net | experience comes from bad judgment.
> domain: summertriangle | -- Mark Twain

From: Richard Maine on
Ronald Benedik <rbenedik(a)fsmat.htu.tuwien.ac.at> wrote:

> "Richard Maine" <nospam(a)see.signature> schrieb im Newsbeitrag
> news:1jbff4h.17lx0qbyblyomN%nospam(a)see.signature...
> > Ronald Benedik <rbenedik(a)fsmat.htu.tuwien.ac.at> wrote:
> >
> >> ...there's
> >> better control of data types and subsequently
> >> rounding behavior in C.
> >
> > Eh? I suppose you must be referring to something other than the C
> > standard,

> I refered to gcc.

Ah. Ok. Well, that explains most of your comments then. You are talking
about a particular C compiler - not the C language. That's a rather
large difference.

> Maybe I didn't get something about Fortran but where the
> heck is the sizeof() feature in Fortran 90?.

Sizeof is not very directly meaningful in terms of floating point.
That's much more a storage issue. See the numeric inquiry functions
(digits, epsilon, huge, maxexponent, minexponent, precision, radix,
range, and tiny) for things much more pertinent to floating point. Also
see selected_real_kind. For integers, there is bit_size, though again
that isn't directly about storage.

If you do want storage size, its a bit awkward to do with guaranteed
portability in f90, although there are ways that usually work,
particularly if one restricts oneself to a particular compiler, as you
did with gcc. For example, gcc these days stands for the Gnu Compiler
Collection, which incldes Fortran. With that kind of restriction, it is
easy enough. F2003 adds some options, though not the more general
storage_size that I proposed. (I think it is in f2008). But again, if
you are talking floating point, sizeof is just the wrong tool; probably
a case of having a hammer and therefore using it for the screw even
though it doesn't quite match.

> I can control
> FPU and SSE register rounding mode in C. It is not possible
> in Fortran 90.

Per above, that's with a particular C compiler and a particular support
library (not the standard C support library) - not a feature of the C
language. If that's what you are talking about, that probably explains
most of your comments. One can do lots of things with particular Fortran
compilers as well.

In terms of the actual language standards, things are very different.
See the IEEE features of f2003 or F95+TR.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
From: David Thompson on
On Mon, 28 Dec 2009 09:15:56 -0800, nospam(a)see.signature (Richard
Maine) wrote:

> Ronald Benedik <rbenedik(a)fsmat.htu.tuwien.ac.at> wrote:
>
> > Once I wrote a least square program using QR decomposition
> > in C. I dropped the idea of doing it in Fortran because there's
> > better control of data types and subsequently
> > rounding behavior in C.
>
> Eh? I suppose you must be referring to something other than the C
> standard, which I don't recall as saying anything more about about
> floating-point data types or rounding issues than Fortran 77.

Nit: C (since C89) required three nominal types: float=single, double,
and long-double. But they need not be distinct, and in particular
long-double is often the same as double. (And double can be the same
as single if it's big enough e.g. 60-bit hardware.)

But C allowed as much machine-dependence/variation on the exact
details of each of the standard types, which I think was your point.

> Traditional C is noted for its distinct lack of user control over even
> such basic things as whether a function returns single or double
> precision. I also suppose you must be omitting complex data type.

No, C always (even before C89) declared the return type of a function,
except for implicit int -- and that was still fully determined, just
not explicit. Until C99 it promoted _arguments_ from single to double;
and still does for variadic e.g. *printf, or oldstyle (deprecated).
And as noted downthread, until C99 the std-lib math routines (sqrt,
sin, etc., which includes pow) were only double.

> Although standard f77 was severely shortchanged in regards to complex
> type, it wasn't as much so as the C standard of the same time frame.
>
There wasn't _any_ de-jure C standard then. <G> But yes, C both in
standard and usual implementation only recently got complex.