RE: Converting a string to reals



In a previous article, "psycho_dad" <s.nesseris@xxxxxxxxx> wrote:
Hi all,
I have the following problem in f90 for which I would like some help.
I would like to know
how can I convert a string, say "b**2" to a variable so given the
value b=2. the outcome will be 4.?

Imagine that there may be more complex functions like "exp(b**2)" etc
which I would like to be
able to convert them from strings to variables and given a value for b
get a real result.

Can anyone help me?

Cheers,
psycho_dad

What you want is to write a compiler. But barring that
write a little fortran source (text) to a file from fortran,
compile and run it with a system call, and it writes
the result to a file. Then read the file.

There are easier ways to make a living.

Chris

.



Relevant Pages

  • Re: Sunperf library, pure functions?
    ... F95 compilers often were typically evolutionary ... developments from f90 compilers, rather than wholy new from scratch. ... As such, if compiler internals included f90 in their names, these ...
    (comp.lang.fortran)
  • Re: fortran and columns
    ... As of f90, there are 2 different sets of rules. ... The free-form source rules are the easiest - the only limitation ... compiler (I don't recall that you said what compiler you were ... If you need to stick with the old fixed source form (possibly because ...
    (comp.lang.fortran)
  • Re: Help.. subroutines etc..
    ... and i cant find where i ve done mistake! ... You probably got some kind of compiler error message. ... Your subroutine is sitting in the middle of the main program. ... If you are using a compiler capable of at least f90, ...
    (comp.lang.fortran)
  • Re: fortran
    ... > Don;t worry about the new features, I still manager to write F77 code ... > within F90. ... >>> or later compiler, and to learn the newer facilities. ... these same extensions could complicate the learning process. ...
    (comp.lang.fortran)
  • Re: gfortran 2007 annual report
    ... On Windows, you probably mean. ... I use gfortran as a native 64 bit ... compiler on GNU/Linux AMD64 now for about 2.5 years. ... but that is pretty common in old fortran source. ...
    (comp.lang.fortran)