I'm looking for an automated way to turn a decimal value into a fraction in the PARI/GP calculator (gp). For example, I want to turn 0.759765625 into 389/512. I know I can do this manually by typing in '759765625/10^9', but I'd like an easier way, like 'rationalize(0.759765625);' would work in Maxima.
If it can't do this directly, maybe there's a function to count the number of decimal places? Then I could raise 10 to the result of that function. (The function would have to count leading decimal places of 0s to be useful.)