Mathematical Expression parsing tool (Open Source)

Source: Internet
Author: User

The function is simple. It outputs a mathematical expression string and a result value. it is quite easy to use. Compared with the calculator provided by the system, it can easily display expressions. I have released a version before. The new version has the same interface as the old version. The difference is that I have rewritten a library for mathematical expression parsing.

The mathematical expression parsing algorithm uses fractional recursion, which is quite efficient. Maybe the Polish method will be faster. Let's talk about it later.

Code and software:

Http://files.cnblogs.com/WhyEngine/MathExpression.zip

Earlier versions:

Http://www.cnblogs.com/WhyEngine/p/3513478.html

Yesterday I posted a blog post "3D visualization of WHY mathematical expressions", which uses the same expression Parsing Code as it. the expression format is the same. the difference lies in the new version, because today we have added the function of parsing floating point numbers in scientific formats.

Built-in function Operators

(1) Standard Single Object Operator

+ ,-

For example:A =-B

(2) standard binary Operators

+,-, *,/, %, ^

For example, c = a * B

(3) The single-object operator of a function is like sin ()

Positive, negative, abs, floor, ceil, sign, sqrt, exp, log, log2, log10, sin, cos, tan, asin, acos, atan, rand

(4) function binary operators, such as pow (a, B)

Add, sub, multiply, divide, max, min, mod, pow, atan2, rand2,

(5) The operator of the function is like lerp (a, B, r)

Lerp, clamp, gray, add3, min3, max3, average3

(6) function four-object operators, such as average4 (a, B, c, d)

Add4, min4, max4, average4

I will not explain the specific function functions. I can guess the function name. I will not look at the code again.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.