Re: busting sp datatypes



In article <1ekmpg9sbb6l6.dlg@xxxxxxxxxxxxxxx>,
Ron Ford <ron@xxxxxxxxxxxxxxx> wrote:


Don't I need to wrtie an executable staement to figure this out, such as:
mp =selected_int_kind(13)


If I execute a statement, I can't thereafter declare:
integer (kind=mp) :: anything

Does anyone know a portable way to declare, populate and print an integer
with thirteen digits?

I don't understand the above sequence of sentences.
selected_int_kind(13) does what you want in a portable way, provided
the compiler supports an integer that long. If your compiler does
not support integers with 13 digits, then what you want to do is not
portable to that compiler.

integer, parameter :: i13 = selected_int_kind(13)
integer(i13) ::long_int_with_at_least_13_digits
long_int_with_at_least_13_digits = 1234567890123_i13
write(*,'(i14)') long_int_with_at_least_13_digits

Of course, you are free to change the variable names. If your
compiler does not support 13 digit integers, then the above results
in an error at compile time, not run time.

$.02 -Ron Shepard
.



Relevant Pages

  • Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... attributes helps both the writer and the compiler. ... > catch at compile time any out of boundaries access. ... C++ array like types don't have these properties. ... Maybe, if one gets used to template programming, the basis of the ...
    (comp.lang.ada)
  • Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... attributes helps both the writer and the compiler. ... > catch at compile time any out of boundaries access. ... C++ array like types don't have these properties. ... Maybe, if one gets used to template programming, the basis of the ...
    (comp.lang.cpp)
  • Re: Expressing physical units (Was: Reprise: in out parameters for functions)
    ... Dealing with units unknown at compile time. ... knots. ... If you divide nmi by sec, the compiler coughs and tells you ...
    (comp.lang.ada)
  • Re: Is there a better way?
    ... I can freely modify the contents of foo, ... Part of the issue is that C doesn't really have the full language ... Processing done by C at compile time is ... the interpreter and the compiler are permitted to ...
    (comp.lang.lisp)
  • Re: huge number calculator and library
    ... and 72 bit double precision. ... we also had a research lab that used analog computers. ... >>digits to 31 digits a question arose as to whether or not anyone KNEW of any ... why should the compiler raise an objection? ...
    (comp.lang.cobol)