Convert "0.8660254" to "sqrt(3)/2"

Does anyone know how to convert an irrational number, such as "0,866025403784439" to its fractional representation, such as "sqrt(3)/2"?

I know it's impossible to obtain the fraction with a very high precision but maybe you know how to do it with a fair precision.
I don't think this is really possible (though feel free to correct me). You can't obtain the fraction with a "fair" precision. The fraction would be the exact value with infinitely high precision. Converting it to a floating point number with limited precision destroys information.
according to http://www.cplusplus.com/doc/tutorial/variables/
the maximum you can get are 15 digits.

if you need more than this, there are libraries for that, just ask google.
You could probably use an evolutionary algorithm to get a fractional representation that is quite close.
What's an evolutionary algorithm?
Topic archived. No new replies allowed.