Part of the problem is doing math with distances. pgfmath uses 1=1pt to do calculations, while tikz typically uses 1=1cm when graphing. It has the ability to add units to \pgfmathresult, but all it does is take the first unit found while parsing.
This is a macro solution. You might be able to do this using a code key, if you are more comfortable with keys than macros.
\documentclass{article} \usepackage{tikz} %\usepackage{calc}% not needed inside tikz \newcommand{\afro}[2]% #1 = a, #2 = b {\pgfextra{% needed inside a path \pgfmathparse{#1/1cm}% \let\a=\pgfmathresult \pgfmathparse{#2/1cm}% \let\b=\pgfmathresult \pgfmathparse{0.5*(#1*#1\a*\a/#2\b + #2\b)}% \let\r=\pgfmathresult \pgfmathparse{acos(#1\a/\r)}% \let\angle=\pgfmathresult}% arc(\angle:180-\angle:\r cm)% } \begin{document} \begin{tikzpicture} \draw[green] (0,0) arc (37:143:2.5cm); \draw (0,0) node {$O$}; \end{tikzpicture} \begin{tikzpicture} \draw[red] (0,0) \afro{22cm}{11cm}; \draw (0,0) node {$O$}; \end{tikzpicture} \end{document}