Silverfrost Forums

Welcome to our forums

Calculate a simple equation

13 Dec 2018 9:58 #22994

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

13 Dec 2018 11:11 #22995

Perhaps you could post your Fortran code to give an idea of what you are doing.

13 Dec 2018 11:22 #22997

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.

14 Dec 2018 10:54 #23004

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.

Please login to reply.