Metric prefixes

FOR COMMERCIAL USE, PLEASE ENSURE YOU HAVE A COMMERCIAL LICENSE.
ANOTHER WAY TO SUPPORT MY WORK IS BY PURCHASING MY BOOK, CUSTOMER FIRST, VALUE NEXT.
THANK YOU FOR SUPPORTING MY WORK!

The tutorial consists of more than 200 live examples from 50 sections given separately for JAVA, C# and C++. Each of the examples can be copied and run on your own environment. In addition, mXparser provides an extensive collection of over 500 built-in math functions, expressions and symbols. Familiarize yourself with the scope and the syntax. Live testing is the best way to learn. Good luck! 🙂

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: 10 Millions / Kilo

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e = new Expression("10*[M] / [k]");
mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate() );
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ExpressionPtr e = new_Expression("10*[M] / [k]");
mXparser::consolePrintln("Res: " + e->getExpressionString() + " = " + e->calculate() );
Code result
[mXparser-v.5.2.1] Res: 10*[M] / [k] = 10000.0

Case 2: List of supported metric prefixes

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
mXparser.consolePrintHelp("metric prefix");
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
mXparser::consolePrintHelp("metric prefix");
Code result
[mXparser-v.5.2.1] Help content limited to query: 'metric prefix'
  #  Keyword             Type                    Syntax                                        Since Description
  -  --------            ----                    ------                                        ----- -----------
  1. [Y]                 <Unit>                  [Y]                                           4.0   Septillion / Yotta - Metric prefix = 10²⁴ - Dimensionless unit
  2. [sept]              <Unit>                  [sept]                                        4.0   Septillion / Yotta - Metric prefix = 10²⁴ - Dimensionless unit
  3. [Z]                 <Unit>                  [Z]                                           4.0   Sextillion / Zetta - Metric prefix = 10²¹ - Dimensionless unit
  4. [sext]              <Unit>                  [sext]                                        4.0   Sextillion / Zetta - Metric prefix = 10²¹ - Dimensionless unit
  5. [E]                 <Unit>                  [E]                                           4.0   Quintillion / Exa - Metric prefix = 10¹⁸ - Dimensionless unit
  6. [quint]             <Unit>                  [quint]                                       4.0   Quintillion / Exa - Metric prefix = 10¹⁸ - Dimensionless unit
  7. [P]                 <Unit>                  [P]                                           4.0   Quadrillion / Peta - Metric prefix = 10¹⁵ - Dimensionless unit
  8. [quad]              <Unit>                  [quad]                                        4.0   Quadrillion / Peta - Metric prefix = 10¹⁵ - Dimensionless unit
  9. [T]                 <Unit>                  [T]                                           4.0   Trillion / Tera - Metric prefix = 10¹² - Dimensionless unit
 10. [tril]              <Unit>                  [tril]                                        4.0   Trillion / Tera - Metric prefix = 10¹² - Dimensionless unit
 11. [G]                 <Unit>                  [G]                                           4.0   Billion / Giga - Metric prefix = 10⁹ - Dimensionless unit
 12. [bil]               <Unit>                  [bil]                                         4.0   Billion / Giga - Metric prefix = 10⁹ - Dimensionless unit
 13. [M]                 <Unit>                  [M]                                           4.0   Million / Mega - Metric prefix = 10⁶ - Dimensionless unit
 14. [mil]               <Unit>                  [mil]                                         4.0   Million / Mega - Metric prefix = 10⁶ - Dimensionless unit
 15. [k]                 <Unit>                  [k]                                           4.0   Thousand / Kilo - Metric prefix = 10³ - Dimensionless unit
 16. [th]                <Unit>                  [th]                                          4.0   Thousand / Kilo - Metric prefix = 10³ - Dimensionless unit
 17. [hund]              <Unit>                  [hund]                                        4.0   Hundred / Hecto - Metric prefix = 10² - Dimensionless unit
 18. [hecto]             <Unit>                  [hecto]                                       4.0   Hundred / Hecto - Metric prefix = 10² - Dimensionless unit
 19. [ten]               <Unit>                  [ten]                                         4.0   Ten / Deca - Metric prefix = 10 - Dimensionless unit
 20. [deca]              <Unit>                  [deca]                                        4.0   Ten / Deca - Metric prefix = 10 - Dimensionless unit
 21. [deci]              <Unit>                  [deci]                                        4.0   Tenth / Deci - Metric prefix = 10⁻¹ - Dimensionless unit
 22. [centi]             <Unit>                  [centi]                                       4.0   Hundredth / Centi - Metric prefix = 10⁻² - Dimensionless unit
 23. [milli]             <Unit>                  [milli]                                       4.0   Thousandth / Milli - Metric prefix = 10⁻³ - Dimensionless unit
 24. [mic]               <Unit>                  [mic]                                         4.0   Millionth / Micro - Metric prefix = 10⁻⁶ - Dimensionless unit
 25. [n]                 <Unit>                  [n]                                           4.0   Billionth / Nano - Metric prefix = 10⁻⁹ - Dimensionless unit
 26. [p]                 <Unit>                  [p]                                           4.0   Trillionth / Pico - Metric prefix = 10⁻¹² - Dimensionless unit
 27. [f]                 <Unit>                  [f]                                           4.0   Quadrillionth / Femto - Metric prefix = 10⁻¹⁵ - Dimensionless unit
 28. [a]                 <Unit>                  [a]                                           4.0   Quintillionth / Atoo - Metric prefix = 10⁻¹⁸ - Dimensionless unit
 29. [z]                 <Unit>                  [z]                                           4.0   Sextillionth / Zepto - Metric prefix = 10⁻²¹ - Dimensionless unit
 30. [y]                 <Unit>                  [y]                                           4.0   Septillionth / Yocto - Metric prefix = 10⁻²⁴ - Dimensionless unit
[mXparser-v.5.2.1] 
Nuget – Package Manager (C#, F#, Visual Basic, …)

Install-Package MathParser.org-mXparser-Version 6.1.1

Nuget – .NET CLI

dotnet add package MathParser.org-mXparser--version 6.1.1

Nuget – Package Reference

<PackageReference Include="MathParser.org-mXparser"Version="6.1.1"/>

Maven – Dependency (Java, Kotlin, Scala, Groovy, …)

<dependency>
<groupid>
org.mariuszgromada.math</groupid>
<artifactid>
MathParser.org-mXparser</artifactid>
<version>
6.1.1</version>
</dependency>

Maven – Gradle

implementation 'org.mariuszgromada.math:MathParser.org-mXparser:6.1.1'

CMake – Dependency / FetchContent (C++, MSVC, LLVM/Clang, GNU/GCC, MinGW, MSYS2, WSL, Windows, Linux, Unix, MacOS)

include(FetchContent)
FetchContent_Declare(
MathParserOrgMxParser
GIT_REPOSITORY
https://github.com/mariuszgromada/MathParser.org-mXparser.git
GIT_TAG
v.6.1.1
SOURCE_SUBDIR CURRENT/cpp/lib
)
FetchContent_MakeAvailable(
MathParserOrgMxParser)
mxparser_link(YourExecutable)

GitHub

git clone https://github.com/mariuszgromada/MathParser.org-mXparser

OTHER DOWNLOAD OPTIONS

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 CODE

Source code .zipSource code .tar.gz
View on GitHubMathSpace.pl

My other creative spaces

DONATION
Did you find the software useful?
Please consider donation 🙂
DONATE