as the others have said, it has something to do with the approach.
but look at this. maybe it will help you!
ps: doenst work for all numbers! for example x,42300000000000000001
Edit: e was randomly generated
Code:
const
e = 0.0000000001;
function CountDigitsAfterPoint(AValue: Extended): Byte;
var r: Extended;
begin
Result := 0;
r := Int(AValue);
while ((Frac(AValue) <> 0) and ((AValue - r) > e)) do
begin
Inc(Result);
AValue := AValue * 10;
r := Int(AValue+e);
end;
end;