Steve Heberts dotMath Libraryhttp://dotmath.codeplex.com/project/feeds/rssThe dotMath library is a two-pass expression compiler written entirely in C# for the Microsoft .NET platform. The library requires only the core .NET library dependency and does not require any file access privilages for execution - compilation and execution occurs entirely in-memory.Commented Issue: Boolean expressions [12575]http://dotmath.codeplex.com/workitem/12575Hi, I had been testing this library, it's awsome, but It looks like the boolean expressions have some problems an expression like "100>50 and 30>50" returns "1" instead of "0" (False), and "30>50 and 100>50" returns "0". I think that the Calculate() methos is only evaluating the first part of the expression.<br /> <br />Richo<br />Comments: ** Comment from web user: Parks75 ** <p>I'm having the same issue trying to do a Bitwise AND on two integers. It always returns 1.</p>Parks75Mon, 02 Jun 2014 13:45:22 GMTCommented Issue: Boolean expressions [12575] 20140602014522PReviewed: 1.0 Production (Nov 30, 2013)https://dotmath.codeplex.com/releases/view/875#ReviewBy-CircaLucidRated 5 Stars (out of 5) - Awesome library. I've used this extensively in my HMO Enrollment web apps and it works flawlessly. Thank you!CircaLucidSat, 30 Nov 2013 18:19:37 GMTReviewed: 1.0 Production (Nov 30, 2013) 20131130061937PCreated Unassigned: Nested If's [34598]http://dotmath.codeplex.com/workitem/34598I have notice an issue with nesting "if" statements<br /><br />If you have nested the if in the Then value then you get a error with the paramcheck not having enough parameters. So this fails<br /><br />___if(1>0,if(1==1,99,77),11)___<br /><br />but if you put the if in the else then everything is fine.<br />So this works<br /><br />___if(1>0,11,if(1==1,99,77))___<br />KiffeeThu, 24 Oct 2013 13:22:49 GMTCreated Unassigned: Nested If's [34598] 20131024012249PSource code checked in, #99885http://dotmath.codeplex.com/SourceControl/changeset/changes/99885Upgrade: New Version of LabDefaultTemplate.xaml. To upgrade your build definitions, please visit the following link: http://go.microsoft.com/fwlink/?LinkId=254563Project Collection Service AccountsMon, 01 Oct 2012 21:24:31 GMTSource code checked in, #99885 20121001092431PSource code checked in, #99884http://dotmath.codeplex.com/SourceControl/changeset/changes/99884Checked in by server upgradeProject Collection Service AccountsMon, 01 Oct 2012 21:16:08 GMTSource code checked in, #99884 20121001091608PCommented Issue: Complex calculation [25995]http://dotmath.codeplex.com/workitem/25995if(4>5,10,100) * 5 ====> 500 but not calculated correctly.<br />Comments: ** Comment from web user: fernandezajp ** <p>replace SetFunction( sEquation ); by SetFunction( "("+sEquation+")" );<br />in EqCompiler constructor</p>fernandezajpWed, 20 Apr 2011 14:39:01 GMTCommented Issue: Complex calculation [25995] 20110420023901PSource code checked in, #74794http://dotmath.codeplex.com/SourceControl/changeset/changes/74794Checked in by server upgrade_TFSSERVICETue, 03 Aug 2010 19:44:57 GMTSource code checked in, #74794 20100803074457PCreated Issue: Complex calculation [25995]http://dotmath.codeplex.com/WorkItem/View.aspx?WorkItemId=25995if(4>5,10,100) * 5 ====> 500 but not calculated correctly.<br />tunzeyWed, 20 Jan 2010 19:01:59 GMTCreated Issue: Complex calculation [25995] 20100120070159PSource code checked in, #34065http://www.codeplex.com/dotMath/SourceControl/ListDownloadableCommits.aspxFleshed out tests for token and whitespace handling to obtain 100% code coveragesdhebertFri, 20 Jun 2008 16:02:23 GMTSource code checked in, #34065 20080620040223PSource code checked in, #34059http://www.codeplex.com/dotMath/SourceControl/ListDownloadableCommits.aspxAdded Token.Equals override testssdhebertThu, 19 Jun 2008 11:08:55 GMTSource code checked in, #34059 20080619110855ASource code checked in, #34058http://www.codeplex.com/dotMath/SourceControl/ListDownloadableCommits.aspxAdded GetHashCode TestssdhebertThu, 19 Jun 2008 11:00:50 GMTSource code checked in, #34058 20080619110050ASource code checked in, #34057http://www.codeplex.com/dotMath/SourceControl/ListDownloadableCommits.aspxAdd Token constructor testssdhebertThu, 19 Jun 2008 10:49:20 GMTSource code checked in, #34057 20080619104920ASource code checked in, #34056http://www.codeplex.com/dotMath/SourceControl/ListDownloadableCommits.aspxAdded CharType enumerationsdhebertThu, 19 Jun 2008 10:29:37 GMTSource code checked in, #34056 20080619102937ASource code checked in, #34055http://www.codeplex.com/dotMath/SourceControl/ListDownloadableCommits.aspxInitial checkin with base testssdhebertThu, 19 Jun 2008 03:12:09 GMTSource code checked in, #34055 20080619031209ACOMMENTED ISSUE: Boolean expressionshttp://www.codeplex.com/dotMath/WorkItem/View.aspx?WorkItemId=12575Hi, I had been testing this library, it's awsome, but It looks like the boolean expressions have some problems an expression like "100>50 and 30>50" returns "1" instead of "0" (False), and "30>50 and 100>50" returns "0". I think that the Calculate() methos is only evaluating the first part of the expression.<br /><br />Richo<br />Comments: ** Comment from web user: exigeguy ** <p>I tried your test case and I was able to get it to work by wrapping either side of the and with parenthesis, e.g. (100 > 50) && (30>50). I had to add the CAnd operator in the InitFunctions() method. The problem is it gets fouled up trying to evaluate complex logical expressions because it is trying to evaluate 50 && 30>50 instead of maintaining the expression to the left of the && operator. I fixed it locally and also added support for string operations.</p>exigeguyWed, 06 Feb 2008 20:12:46 GMTCOMMENTED ISSUE: Boolean expressions 20080206081246PCREATED ISSUE: Boolean expressionshttp://www.codeplex.com/dotMath/WorkItem/View.aspx?WorkItemId=12575Hi, I had been testing this library, it's awsome, but It looks like the boolean expressions have some problems an expression like "100>50 and 30>50" returns "1" instead of "0" (False), and "30>50 and 100>50" returns "0". I think that the Calculate() methos is only evaluating the first part of the expression.<br /><br />Richo<br/>ralcortaTue, 04 Sep 2007 17:14:47 GMTCREATED ISSUE: Boolean expressions 20070904051447PNew Post: In Commercial Library...http://dotmath.codeplex.com/Thread/View.aspx?ThreadId=11129<div style="line-height: normal;">
I am creating a commercial charting library for my company. Can I include this library for user-typed<br />equation/function processing?<br /><br />Best regards,<br />Paul.<br /></div>SelormeyPaulThu, 07 Jun 2007 03:57:26 GMTNew Post: In Commercial Library... 20070607035726ANEW POST: In Commercial Library...http://www.codeplex.com/dotMath/Thread/View.aspx?ThreadId=11129<div class="wikidoc">
I am creating a commercial charting library for my company. Can I include this library for user-typed<br />equation/function processing?<br /> <br />Best regards,<br />Paul.<br />
</div>SelormeyPaulThu, 07 Jun 2007 03:57:26 GMTNEW POST: In Commercial Library... 20070607035726AUPDATED WIKI: The History of dotMathhttp://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&title=The History of dotMath&version=5<p>
<h2>A Brief History of dotMath</h2>
</p>
<p>
<h3>Initial Design</h3>
The initial design of .Math came about in 1997 with a need to create a function evaluator in C++. After looking around for commercial libraries, the pieces available generally reached a complexity we weren’t requiring and too expensive. We had a need for fairly simple equations (such as 4<b>x^2 + 2</b>x +24) where we would perform a wide range of values for x and evaluate each one. I went back to my college compiler books, read up on the subject and decided I could handle the problem myself. I decided to expose the variables thorough an interface and allow them to be discovered and set. At this point the code supported a minimal set of trig-functions. This implementation ran approximately 75,000 calculations per second on a Pentium 2 450.<br/>
</p>
<p>
<h3>Creating the Compiler</h3>
I used similar implementations on other projects and contemplated createing a ‘true’ compiler. The speed increase would be significant, but never significant enough to warrant the time spent. Then, in 2000, I decided to go ahead tackle the problem. It became apparent I could make this into a nice O-O based structure with the implementation classes compiled in C++ and instantiated as-needed. This structure gave me the opportunity to make the compiler extensible by registering new functions with the framework. Given the O-O framework, the first two-passes are handled by the code, while the linking was handled during the application compile. It’s a different way of looking at the compilation problem, but much simpler in terms of building and delivering the solution. I took this implementation and ported it to an early Visual Basic.NET implementation to test how the new language O-O features behaved.<br/>
</p>
<p>
<h3>Multi-Parameter Functions and Binary Operators</h3>
Shortly after creating the compiler, the need for more complex functions arose. These functions were modeled after the Excel format with comma-separators. I quickly realized that each function within the statement could be handled as a separate compiled function that shared the same variable space with the rest of the equation. At that point, the implementation became very simple. The most intriguing function then became the If-statement as such:<br/>
</p>
<p>
<pre>
if( condition, then-result, else-result )
</pre>
</p>
<p>
The if-statement required the use of binary operators (<, >, <=, <>, etc). The binary operation returns a 1 for true or a 0 for false. The if statement only tests for 0 equality – perform else portion if 0, otherwise perform then portion.<br/>
</p>
<p>
<h3>Porting to C# and the .NET Platform</h3>
I ported the code to C# in 2003 out of interest in reviving the code. I later used the project in 2004 to provide dimensionality support to a planning application.<br/>
</p>
<p>
<h3>Looking Ahead</h3>
There are a number of directions the code can take, including code optimization and levelization of the called objects. Levelization offers the biggest payback because the current implementation relies heavily on the call-stack. Getting away from the call-stack will remove the reliance on the memory allocations and jumps that become significant when doing millions of operations. I believe levelization of the function calls would involve using an accumulator structure for storing operation values one at a time.<br/>
<br/>
</p>
sdhebertThu, 26 Oct 2006 01:50:06 GMTUPDATED WIKI: The History of dotMath 20061026015006AUPDATED WIKI: Built-in functions and operatorshttp://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&title=Built-in functions and operators&version=3<p>
<h2>Built-in Operators and Functions</h2>
</p>
<p>
The following lists show the built-in functions and operators that are included in dotMath. You can add your own functions by creating classes and registering with dotMath before compiling. Check out <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&title=Getting%20Started%20-%20How%20to%20use%20dotMath">Getting Started - How to use dotMath</a> to learn more.<br/>
</p>
<p>
</p>
<p>
<h3>Binary Operators </h3>
</p>
<p>
<table border="1" cellspacing="0" cellpadding="3" ><tr><th>Operator</th><th>Description</th></tr>
<tr><td>=</td><td>Returns 1 if both sides are equal.</td></tr>
<tr><td><</td><td>Returns 1 if left side is less than the right.</td></tr>
<tr><td>></td><td>Returns 1 if left side is greater than the right.</td></tr>
<tr><td><=</td><td>Returns 1 if the left side is less than or equal to the right.</td></tr>
<tr><td>>=</td><td>Returns 1 if the left side is greater than or equal to the right.</td></tr>
<tr><td><></td><td>Returns 1 if the left side is not equal to the right.</td></tr>
<tr><td>&</td><td>Returns 1 if both sides are not equal to 0</td></tr>
<tr><td></td><td>Returns 1 if one or both sides are not equal to 1.</td></tr>
</table></p>
<p>
</p>
<p>
<h3>Built-in Functions</h3>
</p>
<p>
<table border="1" cellspacing="0" cellpadding="3" ><tr><th>Function</th><th>Description</th></tr>
<tr><td>Abs</td><td>Absolute value of a specified value or expression.</td></tr>
<tr><td>Acos</td><td>Returns the angle whose cosine is the specified number.</td></tr>
<tr><td>Asin</td><td>Returns the angle whose sin is the specified number.</td></tr>
<tr><td>Atan</td><td>Returns the angle whose tangent is the specified number.</td></tr>
<tr><td>Ceiling</td><td>Returns the smallest whole number greater than or equal to the specified number.</td></tr>
<tr><td>Cos</td><td>Returns the cosine of the specified angle.</td></tr>
<tr><td>Cosh</td><td>Returns the hyperbolic cosine of the specified angle.</td></tr>
<tr><td>Exp</td><td>Returns e raised to the specified power.</td></tr>
<tr><td>Floor</td><td>Returns the largest whole number less than or equal to the specified number.</td></tr>
<tr><td>Log</td><td>Returns the logarithm of the specified number.</td></tr>
<tr><td>Log10</td><td>Returns the base 10 logarithm of the specified number.</td></tr>
<tr><td>Round</td><td>Returns the value nearest the specified value.</td></tr>
<tr><td>Sign</td><td>Returns a value indicating the sign of the specified value.</td></tr>
<tr><td>Sin</td><td>Returns the sine of the specified angle.</td></tr>
<tr><td>Sinh</td><td>Returns the hyperbolic sine of the specified angle.</td></tr>
<tr><td>Sqrt</td><td>Returns the square root of the specified number.</td></tr>
<tr><td>Tan</td><td>Returns the tangent of the specified angle.</td></tr>
<tr><td>Tanh</td><td>Returns the hyperbolic tangent of the specified angle.</td></tr>
<tr><td>Min</td><td>Min(expr1, expr2, <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&title=%u2026%2c%20expr%28n%29">…, expr(n)</a>) Min returns the minimum value among the list of evaluated expressions. The list may contain 2 or more elements. Highest current test uses 50,000 values in the expression list.</td></tr>
<tr><td>Max</td><td>Max(expr1, expr2, <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&title=%u2026%2c%20expr%28n%29">…, expr(n)</a>) Max returns the maximum value among the list of evaluated expressions. The list may contain 2 or more elements. Highest current test uses 50,000 values in the expression list.</td></tr>
<tr><td>If</td><td>If( binary<i>expression, true</i>expression, false<i>expression ) If the value of binary</i>expression is non-zero, the true<i>expression evaluation is returned. Otherwies the false</i>expression is returned.</td></tr>
</table></p>
<p>
<br/>
</p>
sdhebertThu, 26 Oct 2006 01:49:55 GMTUPDATED WIKI: Built-in functions and operators 20061026014955A