View previous topic :: View next topic |
Author |
Message |
hemconsult
Joined: 11 Dec 2018 Posts: 2
|
Posted: Thu Dec 13, 2018 10:58 am Post subject: Calculate a simple equation |
|
|
Hi!
I'm new to this Forum, and hope that it's OK if I'm asking for help on the above topic
I'm working with a project where I shall report the result of an equation that goes like this: 6.0 / (( 120.45 / 10 / 4.671 ) - 1 )
The equation is held in a string and not a hard coded thing.
For now, I'm using a CISSUE call to a DOS program called CALC written by Ryan Shillington. It's working, but it's a bit tricky to get the result back and a DOS-box flashes up for every calculation.
My hope is, that someone has a bit of Fortran code, that can do this, so that I don't need to start inventing the wheel again
Thanks, Henrik |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7933 Location: Salford, UK
|
Posted: Thu Dec 13, 2018 12:11 pm Post subject: |
|
|
Perhaps you could post your Fortran code to give an idea of what you are doing. |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1891
|
Posted: Thu Dec 13, 2018 12:22 pm Post subject: |
|
|
The CALC program that you used requires that you spawn a new process (a CMD session) and retrieve the result from the standard output of that session.
There are a number of Fortran expression interpreters available. The choice depends on what types of expressions you wish to cover.
See, for example, https://github.com/ivomarb/Fortran-Expression-Evaluator . You can build the interpreter into a DLL and simply make calls to routines in the DLL, as many times as needed. |
|
Back to top |
|
|
hemconsult
Joined: 11 Dec 2018 Posts: 2
|
Posted: Fri Dec 14, 2018 11:54 am Post subject: |
|
|
Thanks for the replies.
To mecej4. A special thanks to you for guiding me to the Fortran-Expression-Evaluator. It was very useful and I have been able to get the results that I was aiming for. |
|
Back to top |
|
|
|