473,395 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

expressions

Hello,
I have a need to take user inputted text such as:

13.5*(1./((1./5)-1.))**(1./4.17)

and evaluate to a number. What key words would I google on? Or are they
some decent object oriented books that you know of that cover this? Online
tutorials or sample source?

Thanks in advanced,
Dan


Nov 15 '05 #1
3 924
Hi Dan!

"Dan H." <Da********@NO.comcast.SsPpAaMm.net> schrieb im Newsbeitrag
news:Ov**************@TK2MSFTNGP11.phx.gbl...
I have a need to take user inputted text such as: 13.5*(1./((1./5)-1.))**(1./4.17) and evaluate to a number. What key words would I google on? Or are they some decent object oriented books that you know of that cover this? Online tutorials or sample source?


Maybe this link is of any use for you:
http://www.codeproject.com/csharp/matheval.asp

With kind regards,

Konrad
Nov 15 '05 #2
Dan H. wrote:
Hello,
I have a need to take user inputted text such as:

13.5*(1./((1./5)-1.))**(1./4.17)

and evaluate to a number. What key words would I google on? Or are
they some decent object oriented books that you know of that cover
this? Online tutorials or sample source?


http://www.csharphelp.com/archives2/archive289.html

The above link will prove most helpful. It includes the source and is
both freely modifiable and distributable. It provides a powerful and
flexible framework with a number of built-in functions and even allows
you to add functions of your own. It also parses any number of
parameters to be fed to user-defined functions and passes them along
when invoking those functions.

The one spot of trouble I had with it was the expression parser. It was
rather flakey when it came to handling characters such as ":", " "
(space) and "_". I believe it was due to the author's use of character
scanning. I rewrote my copy of the code to use Regex.Split. Not only is
the code simpler and easier to modify but it's also much more
predictable. Should the expression parser prove to be a problem for you,
I'll be glad to forward you a copy of what I have.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 15 '05 #3
Dan H. wrote:
Hello,
I have a need to take user inputted text such as:

13.5*(1./((1./5)-1.))**(1./4.17)

and evaluate to a number. What key words would I google on? Or are they
some decent object oriented books that you know of that cover this? Online
tutorials or sample source?


If your users can live with JavaScipt expression syntax, take a look at
http://groups.google.com/groups?&sel...TNGP09.phx.gbl

and use the expression evaluator built into JScript.NET

The above expression in JavaScript would look like:

Math.Pow( 13.5*(1./((1./5)-1.)), (1./4.17))

--
mikeb

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

72
by: Raymond Hettinger | last post by:
Peter Norvig's creative thinking triggered renewed interest in PEP 289. That led to a number of contributors helping to re-work the pep details into a form that has been well received on the...
1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
5
by: jens | last post by:
I was wondering if anyone could tell be whether it's possible to instruct preg_match not to save subexpressions matches under 0, 1...n keys when using named subexpressions; I.e instruct preg_named...
7
by: mark | last post by:
Access 2000: I creating a report that has a record source built by the user who selects the WHERE values. An example is: SELECT * FROM CHARGELOG WHERE STDATE Between #10/27/2003# And...
2
by: Sehboo | last post by:
Hi, I have several regular expressions that I need to run against documents. Is it possible to combine several expressions in one expression in Regex object. So that it is faster, or will I...
4
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or...
56
by: Luke Matuszewski | last post by:
I am designing the library, which will hidden all its functions within singleton object ... So for clients they will use it like . eg. system.getElementWithId('ruler'); At library side, i...
2
by: aarklon | last post by:
Hi all, Recently i was reading a c book which contained a section called C pitfalls. it had a paragraph on the following lines:- ...
1
by: Allan Ebdrup | last post by:
I have a dynamic list of regular expressions, the expressions don't change very often but they can change. And I have a single string that I want to match the regular expressions against and find...
3
by: RobG | last post by:
There has been a discussion on the iPhone web development group where an opinion has been expressed that function expressions are bad for performance and can be avoided by using function...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.