Re: Is it time to legitimise REAL*8 etc?



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

.



Relevant Pages

  • Re: Oracle-Number werden tlw. als Zahl/Double erstellt
    ... you can also specify a precision (total number of digits) and scale. ... der wohl in unterschiedlichen Versionen unterschiedliche DDL-Anweisungen für ein Number-Feld ohne jegliche Dimensionierung erstellt hat. ...
    (microsoft.public.de.access.clientserver)
  • Re: controversial paper
    ... I need only specify a location (the zero ... bits that differ. ... regions to the network (add more digits on the right). ...
    (sci.crypt)
  • Re: Monetary calculations in CL
    ... things like yield rates that specify a number of places of precision and ... round the 13th (by implication do not employ precision to more than the ... calculations can easily consume 20 or more significant digits. ... of places of significance and the rounding policy are supplied. ...
    (comp.lang.lisp)
  • Re: limitation to the halting proof
    ... > So you DO concede that the diagonal number does not appear as a member of the ... it appears that a sequence of digits is not present. ... >>By induction the number is contained in the list for infinite digits. ... possible to specify a 1 digit number that is not listable. ...
    (comp.theory)
  • Re: example of KIND to replace DOUBLE PRECISION
    ... I thought that single precision on 32-bit cpu's ment 13+ safe digits, ... specified number of significant decimal digits or exponent range. ... specify that with SELECTED_REAL_KIND and use the appropriate ...
    (comp.lang.fortran)