Starting in 1996, Alexa Internet has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to the Wayback Machine after an embargo period.
The inspiration to write this code was to have an
easy-to-use parser for functions given as string. You have a string like
"cos(x)-7*x/(1+x)"
and you want to compute some values, maybe for displaying
the graph of the function. You can write code like this:
CFunction<longdouble>* fkt =
CFunction<longdouble>::Parse("cos(x)-7*x/(1+x)");
longdouble y = fkt->Execute(1.5);
There are lots of definitions in the background, but the
result is easy and fast! There is a one-time pasing step to construct the
function tree, and function evaluations are only calls of standard math
functions like sin, +, *, sqrt. When you want to know details about the
implementaion, you should look into the source code. It would be too complex to
describe the parsing algorithm here.
Add www.codeguru.com to your favorites Add www.codeguru.com to your browser search box IE 7 | Firefox 2.0 | Firefox 1.5.xReceive news via our XML/RSS feed
RATE THIS ARTICLE:
Excellent Very Good Average Below Average Poor
(You must be signed in to rank an article. Not a member? Click here to register)