forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Calculate a simple equation

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
hemconsult



Joined: 11 Dec 2018
Posts: 2

PostPosted: Thu Dec 13, 2018 10:58 am    Post subject: Calculate a simple equation Reply with quote

Hi!
I'm new to this Forum, and hope that it's OK if I'm asking for help on the above topic Question

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 Smile

Thanks, Henrik
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7912
Location: Salford, UK

PostPosted: Thu Dec 13, 2018 12:11 pm    Post subject: Reply with quote

Perhaps you could post your Fortran code to give an idea of what you are doing.
Back to top
View user's profile Send private message AIM Address
mecej4



Joined: 31 Oct 2006
Posts: 1884

PostPosted: Thu Dec 13, 2018 12:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
hemconsult



Joined: 11 Dec 2018
Posts: 2

PostPosted: Fri Dec 14, 2018 11:54 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group