Java library

There are library for java programs?
or a compiled program that can be called from command using arguments and print result to command too.

I have trying to create my own algorithm to calculate unlimited number digit, but it's very very slow when calculating very long formula... so I need to use this library as it's very fast...

Thank You, and sorry for my bad English

Added by: tomek, 2017 VI 01, Last modified: 2017 VI 01

This is only a C++ library, there is no Java version. An executable program can be written in this way:

#include <ttmath/ttmath.h>
#include <iostream>

int main(int argc, char ** argv)
{
	typedef ttmath::Big<1,5> MyBig;
	ttmath::Parser<MyBig> parser;
	std::string all_input;

	for(int i=1 ; i<argc ; ++i)
	{
		all_input += argv[i];
		all_input += ' ';
	}

	ttmath::ErrorCode err = parser.Parse(all_input);

	if( err == ttmath::err_ok )
	{
		for(size_t i=0 ; i< parser.stack.size() ; ++i)
			std::cout << parser.stack[i].value << std::endl;
	}
	
	return static_cast<int>(err);
}

$ clang++ -o sample -I../ttmath -O2 -s sample.cpp
$ ./sample '(3+4) ^ (23+23)'
7.49048330965186233494494102694564493649e+38
$ ./sample '5+6 ; 3-7'
11
-4

Added by: ~Jimz, 2017 VI 01

Thank you for reply.
i'm not familiar with c++ syntax, and i don't know how to compile c++ code to executable program.
i will learn it as soon as possible.
Many thanks for your reply and code example..