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.