Tutorial Math Collection API spec Download
Below is the code for JAVA, C# (the code for C# is almost identical) and C++. To copy the code, double-click inside the frame. Case 1: Bitwise unary complement Java/C# code// JAVA: import org.mariuszgromada.math.mxparser.*; // C#: using org.mariuszgromada.math.mxparser; // ... Expression e1 = new Expression("@~ 2"); Expression e2 = new Expression("@~ b.10"); double v1 = e1.calculate(); double v2 = e2.calculate(); mXparser.consolePrintln("Res 1: " + e1.getExpressionString() + " = " + v1 ); mXparser.consolePrintln("Res 2: " + e2.getExpressionString() + " = " + v2 + ", bits = " + mXparser.convDecimal2OthBase(v2, 2));C++ code
#include "org/mariuszgromada/math/mxparser.hpp" // ... ExpressionPtr e1 = new_Expression("@~ 2"); ExpressionPtr e2 = new_Expression("@~ b.10"); double v1 = e1->calculate(); double v2 = e2->calculate(); mXparser::consolePrintln("Res 1: " + e1->getExpressionString() + " = " + v1 ); mXparser::consolePrintln("Res 2: " + e2->getExpressionString() + " = " + v2 + ", bits = " + mXparser::convDecimal2OthBase(v2, 2));Code result
[mXparser-v.5.2.1] Res 1: @~ 2 = -3.0 [mXparser-v.5.2.1] Res 2: @~ b.10 = -3.0, bits = -11Case 2: Bitwise AND Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*; // C#: using org.mariuszgromada.math.mxparser; // ... Expression e1 = new Expression("13 @& 10"); Expression e2 = new Expression("b.1101 @& b.1010"); double v1 = e1.calculate(); double v2 = e2.calculate(); mXparser.consolePrintln("Res 1: " + e1.getExpressionString() + " = " + v1 ); mXparser.consolePrintln("Res 2: " + e2.getExpressionString() + " = " + v2 + ", bits = " + mXparser.convDecimal2OthBase(v2, 2));C++ code
#include "org/mariuszgromada/math/mxparser.hpp" // ... ExpressionPtr e1 = new_Expression("13 @& 10"); ExpressionPtr e2 = new_Expression("b.1101 @& b.1010"); double v1 = e1->calculate(); double v2 = e2->calculate(); mXparser::consolePrintln("Res 1: " + e1->getExpressionString() + " = " + v1 ); mXparser::consolePrintln("Res 2: " + e2->getExpressionString() + " = " + v2 + ", bits = " + mXparser::convDecimal2OthBase(v2, 2));Code result
[mXparser-v.5.2.1] Res 1: 13 @& 10 = 8.0 [mXparser-v.5.2.1] Res 2: b.1101 @& b.1010 = 8.0, bits = 1000Case 3: Bitwise exclusive OR Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*; // C#: using org.mariuszgromada.math.mxparser; // ... Expression e1 = new Expression("13 @^ 10"); Expression e2 = new Expression("b.1101 @^ b.1010"); double v1 = e1.calculate(); double v2 = e2.calculate(); mXparser.consolePrintln("Res 1: " + e1.getExpressionString() + " = " + v1 ); mXparser.consolePrintln("Res 2: " + e2.getExpressionString() + " = " + v2 + ", bits = " + mXparser.convDecimal2OthBase(v2, 2));C++ code
#include "org/mariuszgromada/math/mxparser.hpp" // ... ExpressionPtr e1 = new_Expression("13 @^ 10"); ExpressionPtr e2 = new_Expression("b.1101 @^ b.1010"); double v1 = e1->calculate(); double v2 = e2->calculate(); mXparser::consolePrintln("Res 1: " + e1->getExpressionString() + " = " + v1 ); mXparser::consolePrintln("Res 2: " + e2->getExpressionString() + " = " + v2 + ", bits = " + mXparser::convDecimal2OthBase(v2, 2));Code result
[mXparser-v.5.2.1] Res 1: 13 @^ 10 = 7.0 [mXparser-v.5.2.1] Res 2: b.1101 @^ b.1010 = 7.0, bits = 111Case 4: Bitwise inclusive OR Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*; // C#: using org.mariuszgromada.math.mxparser; // ... Expression e1 = new Expression("13 @| 10"); Expression e2 = new Expression("b.1101 @| b.1010"); double v1 = e1.calculate(); double v2 = e2.calculate(); mXparser.consolePrintln("Res 1: " + e1.getExpressionString() + " = " + v1 ); mXparser.consolePrintln("Res 2: " + e2.getExpressionString() + " = " + v2 + ", bits = " + mXparser.convDecimal2OthBase(v2, 2));C++ code
#include "org/mariuszgromada/math/mxparser.hpp" // ... ExpressionPtr e1 = new_Expression("13 @| 10"); ExpressionPtr e2 = new_Expression("b.1101 @| b.1010"); double v1 = e1->calculate(); double v2 = e2->calculate(); mXparser::consolePrintln("Res 1: " + e1->getExpressionString() + " = " + v1 ); mXparser::consolePrintln("Res 2: " + e2->getExpressionString() + " = " + v2 + ", bits = " + mXparser::convDecimal2OthBase(v2, 2));Code result
[mXparser-v.5.2.1] Res 1: 13 @| 10 = 15.0 [mXparser-v.5.2.1] Res 2: b.1101 @| b.1010 = 15.0, bits = 1111Case 5: Signed left shift Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*; // C#: using org.mariuszgromada.math.mxparser; // ... Expression e1 = new Expression("13 @<< 2"); Expression e2 = new Expression("b.1101 @<< b.10"); double v1 = e1.calculate(); double v2 = e2.calculate(); mXparser.consolePrintln("Res 1: " + e1.getExpressionString() + " = " + v1 ); mXparser.consolePrintln("Res 2: " + e2.getExpressionString() + " = " + v2 + ", bits = " + mXparser.convDecimal2OthBase(v2, 2));C++ code
#include "org/mariuszgromada/math/mxparser.hpp" // ... ExpressionPtr e1 = new_Expression("13 @<< 2"); ExpressionPtr e2 = new_Expression("b.1101 @<< b.10"); double v1 = e1->calculate(); double v2 = e2->calculate(); mXparser::consolePrintln("Res 1: " + e1->getExpressionString() + " = " + v1 ); mXparser::consolePrintln("Res 2: " + e2->getExpressionString() + " = " + v2 + ", bits = " + mXparser::convDecimal2OthBase(v2, 2));Code result
[mXparser-v.5.2.1] Res 1: 13 @<< 2 = 52.0 [mXparser-v.5.2.1] Res 2: b.1101 @<< b.10 = 52.0, bits = 110100Case 6: Signed right shift Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*; // C#: using org.mariuszgromada.math.mxparser; // ... Expression e1 = new Expression("13 @>> 2"); Expression e2 = new Expression("b.1101 @>> b.10"); double v1 = e1.calculate(); double v2 = e2.calculate(); mXparser.consolePrintln("Res 1: " + e1.getExpressionString() + " = " + v1 ); mXparser.consolePrintln("Res 2: " + e2.getExpressionString() + " = " + v2 + ", bits = " + mXparser.convDecimal2OthBase(v2, 2));C++ code
#include "org/mariuszgromada/math/mxparser.hpp" // ... ExpressionPtr e1 = new_Expression("13 @>> 2"); ExpressionPtr e2 = new_Expression("b.1101 @>> b.10"); double v1 = e1->calculate(); double v2 = e2->calculate(); mXparser::consolePrintln("Res 1: " + e1->getExpressionString() + " = " + v1 ); mXparser::consolePrintln("Res 2: " + e2->getExpressionString() + " = " + v2 + ", bits = " + mXparser::convDecimal2OthBase(v2, 2));Code result
[mXparser-v.5.2.1] Res 1: 13 @>> 2 = 3.0 [mXparser-v.5.2.1] Res 2: b.1101 @>> b.10 = 3.0, bits = 11Case 7: Bitwise NAND, NOR, XOR (since v.6.0) Java/C# code
// Getting help content as HTML table String help = mXparser.getHelpAsHtmlTable("bitwise"); mXparser.consolePrintln(help);C++ code
#include "org/mariuszgromada/math/mxparser.hpp" // ... StringPtr help = mXparser::getHelpAsHtmlTable("bitwise"); mXparser::consolePrintln(help);Code result Help content limited to query: βbitwiseβ Keyword Type Syntax Since Description @~& Bitwise operator a @~& b 6.0 Bitwise not and (NAND) β Bitwise operator @~| Bitwise operator a @~| b 6.0 Bitwise not or (NOR) β Bitwise operator @~^ Bitwise operator a @~^ b 6.0 Bitwise exclusive NOR (XNOR) β Bitwise operator Nuget β Package Manager (C#, F#, Visual Basic, β¦)
Install-Package
MathParser.org-mXparser
-Version
6.1.0
dotnet add package
MathParser.org-mXparser
--version
6.1.0
<PackageReference Include=
"MathParser.org-mXparser"
Version=
"6.1.0"
/>
<dependency>
<groupid>org.mariuszgromada.math
</groupid>
<artifactid>MathParser.org-mXparser
</artifactid>
<version>6.1.0
</version>
</dependency>
implementation
'org.mariuszgromada.math:MathParser.org-mXparser:6.1.0'
include(FetchContent)
FetchContent_Declare(MathParserOrgMxParser
GIT_REPOSITORY https://github.com/mariuszgromada/MathParser.org-mXparser.git
GIT_TAG v.6.1.0
SOURCE_SUBDIR CURRENT/cpp/lib
)
FetchContent_MakeAvailable(MathParserOrgMxParser
)
target_link_libraries(YourExecutable MathParserOrgMxParser
)
git clone
https://github.com/mariuszgromada/MathParser.org-mXparser
Download latest release β v.6.1.0 Sagitara: .NET bin onlyDownload latest release β v.6.1.0 Sagitara: JAVA bin onlyDownload latest release β v.6.1.0 Sagitara: bin + doc
NEWS FROM MATHPARSER.ORG SOURCE CODESource code .zipSource code .tar.gz
View on GitHubMathSpace.pl
Did you find the software useful?
Please consider donation π
DONATERetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4