2 trimmed a few characters

# Mathematica, 128111 characters

f=Module[{a=0,b=1,k},Do[If[Round[aWhile[Round[a/b,10^-(StringLength[#]-2)]==]!=(k=ToExpression)[#],Break[]@#,If[N[a/b]>k[#]b]>k@#,b++,a++]],{999}];aa++]];a/b]&


Pretty simple really, and I don't think it converges anywhere as fast as the other solutions, since the numerator and denominator only increment by one. I mostly wanted to find the simple solution to this. I'll have to see the other answers and see what clever stuff happens there.

## Output

f/@{"1.7","0.0","0.001","3.1416","3.14"}
{5/3, 0, 1/667, 355/113, 22/7}


Does anyone here celebrate Pi Approximation Day?

# Mathematica, 128 characters

f=Module[{a=0,b=1,k},Do[If[Round[a/b,10^-(StringLength[#]-2)]==(k=ToExpression)[#],Break[],If[N[a/b]>k[#],b++,a++]],{999}];a/b]&


Pretty simple really, and I don't think it converges anywhere as fast as the other solutions, since the numerator and denominator only increment by one. I mostly wanted to find the simple solution to this. I'll have to see the other answers and see what clever stuff happens there.

## Output

f/@{"1.7","0.0","0.001","3.1416","3.14"}
{5/3, 0, 1/667, 355/113, 22/7}


Does anyone here celebrate Pi Approximation Day?

# Mathematica, 111 characters

f=Module[{a=0,b=1,k},While[Round[a/b,10^-(StringLength[#]-2)]!=(k=ToExpression)@#,If[N[a/b]>k@#,b++,a++]];a/b]&


Pretty simple really, and I don't think it converges anywhere as fast as the other solutions, since the numerator and denominator only increment by one. I mostly wanted to find the simple solution to this. I'll have to see the other answers and see what clever stuff happens there.

## Output

f/@{"1.7","0.0","0.001","3.1416","3.14"}
{5/3, 0, 1/667, 355/113, 22/7}


Does anyone here celebrate Pi Approximation Day?

1

# Mathematica, 128 characters

f=Module[{a=0,b=1,k},Do[If[Round[a/b,10^-(StringLength[#]-2)]==(k=ToExpression)[#],Break[],If[N[a/b]>k[#],b++,a++]],{999}];a/b]&


Pretty simple really, and I don't think it converges anywhere as fast as the other solutions, since the numerator and denominator only increment by one. I mostly wanted to find the simple solution to this. I'll have to see the other answers and see what clever stuff happens there.

## Output

f/@{"1.7","0.0","0.001","3.1416","3.14"}
{5/3, 0, 1/667, 355/113, 22/7}


Does anyone here celebrate Pi Approximation Day?