Hello everybody, I'm new to this site and to the C++ world, and I need your help.
I'm looking for a library that handles rational, irrational and trascendental numbers and calculates the exact results without approximating values.
For example, if I want to calculate:
1 2 3
a = pi;
b = 3;
c = 2;
I want this library to return the result in this way:
sqrt(b*c)*a == sqrt(6)*pi
instead of
sqrt(b*c)*a == 7.6952989
In case it matters, I'm working on Ubuntu and I compile with g++.
You can ask me anything if I didn't explain everything clearly (english isn't my first language)
I'm pretty sure a library like that exists because it's too useful, I researched it but couldn't find anything.
Thank you very much :)
Wow, for a non-native speaker, you're the best I've seen on this site! As for the library that you're looking for, I think the Boost Library might offer it.. I am not familiar with it though... Here's the link: http://www.boost.org/ Good luck!
I don't think its possible
c and b are presumably integer types so they are 'exact' numbers.
Even though b*c is 'exact' (6) the sqrt(b*c) is an approximation.
Likewise pi to a billion decimal places is still an approximation