Re: Is it time to legitimise REAL*8 etc?
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Fri, 27 Jun 2008 11:58:39 -0800
Richard Maine wrote:
Paul van Delst <Paul.vanDelst@xxxxxxxx> wrote:
Could someone explain to me the cumbersomeness of
SELECTED_REAL(INT)_KIND() ??
I agree the syntax is a bit wordy,
Not so wordy as
INTEGER (SELECTED_INT_KIND(9)) :: I
compare to C's
int i;
Yes, that's one thing - one that I think is more important than you make
it out to be. Another is that it just doesn't match the way most people
want/need to specify things. Decimal digits of precision might seem fine
in theory, but that just isn't a good match the reality of programming.
When what you want to do is select between the 32-, 84- and 128-bit
options for real, it is cumbersome to translate that into numbers of
decimal digits.
PL/I only has specifiers in terms of either binary or decimal
digits. In most case, people specify the values for their
favorite system. PL/I uses 3.32 as the conversion between
the two. (Except that IBM compilers, given a request for
FLOAT DECIMAL(16), which comes out 53.12 bits, uses 53
instead of rounding up to 54.)
Quick now, would 15 decimal digits be the 64-bit or 128-bit option?
Maybe you happen to know, but if so, that's an obscure piece of
knowledge... and one that is in danger of being wrong on machines that
use slightly different representations. And when you see two different
programs, where one asks for 12 decimal digits and the other asks for
13, what's the difference? Maybe they seem the same to you, but I've had
people ask.
I agree, though if the values are significant digits then the
numbers you actual want are 24 and 53 in many cases. Still,
I would like to see SELECTED_REAL_BIN_KIND() and SELECTED_BIN_INT_KIND()
(except that they are even longer).
So you would like ones that specify the total length, not just
the significant digits (in some base)?
Another PL/I feature is that some long names have shorter equivalents.
PROC for PROCEDURE, BIN for BINARY, CHAR for CHARACTER.
I would vote for BINARY_REAL_KIND() and BINARY_INT_KIND().
If selected_real_kind asked about binary instead of decimal precision,
that would be an improvement. (I've proposed an option for that, and I
think a variant of that might also be in, but I haven't kept up). But I
think the best option would be that which most closely matched the way
people most naturally ask. That's not in terms of digits of precision,
be they decimal or binary digits. People most commonly ask in terms of
the size of the representation - i.e. they might ask for the 64-bit (or
8-byte) option.
but doesn't one define these things (i.e. different kind types) once in a
module and then use that module where I need anything other than default
REALs/INTs? And then forget about it?
I would hope so, but I sure wish that people would stop giving examples
of the "wrong" way to do it. I think I've even seen those examples in
textbooks. Others see those examples and then think that's actually
normal practice.
When writing a quick, run once, example for the newsgroup,
one tends to use what is faster to write. No excuse for
textbooks, though.
-- glen
.
- References:
- Is it time to legitimise REAL*8 etc?
- From: Clive Page
- Re: Is it time to legitimise REAL*8 etc?
- From: dpb
- Re: Is it time to legitimise REAL*8 etc?
- From: Paul van Delst
- Re: Is it time to legitimise REAL*8 etc?
- From: Richard Maine
- Is it time to legitimise REAL*8 etc?
- Prev by Date: Re: Is it time to legitimise REAL*8 etc?
- Next by Date: Re: Is it time to legitimise REAL*8 etc?
- Previous by thread: Re: Is it time to legitimise REAL*8 etc?
- Next by thread: Re: Is it time to legitimise REAL*8 etc?
- Index(es):
Relevant Pages
|