Here's the code:
2400 \DeclareRobustCommand\fontsize[2] 2401 {\set@fontsize\baselinestretch{#1}{#2}} 2697 \def\set@fontsize#1#2#3{% 2698 \@defaultunits\@tempdimb#2pt\relax\@nnil 2699 \edef\f@size{\strip@pt\@tempdimb}% 2700 \@defaultunits\@tempskipa#3pt\relax\@nnil 2701 \edef\f@baselineskip{\the\@tempskipa}% 2702 \edef\f@linespread{#1}% 2703 \let\baselinestretch\f@linespread 2704 \def\size@update{% 2705 \baselineskip\f@baselineskip\relax 2706 \baselineskip\f@linespread\baselineskip 2707 \normalbaselineskip\baselineskip 2708 \setbox\strutbox\hbox{% 2709 \vrule\@height.7\baselineskip 2710 \@depth.3\baselineskip 2711 \@width\z@}% 2712 \let\size@update\relax}% 2713 }
\@defaultunits is responsible for adding pt to the argument if just a number appears, storing the value in either \@tempdimb (for the size argument) or in \@tempskipa (for the baseline skip argument)
\f@size and \f@baselineskip are set to the value in points (no unit) from the two arguments to \fontsize
\f@linespread is set from the first argument, that is, from \baselinestretch - A temporary macro is defined for updating the values, which will be executed at the next
\selectfont command; the macro \size@updatewill then redefine itself to be\relax`
Note that \size@update will also contain a redefinition of the \strutbox, so a \strut will always be fit to the current font size.
You can call \fontsize{3cm}{4cm} or \fontsize{15}{18} or any mixture with or without units; a unitless is implicitly assumed to be in points.
\fontsizeand\set@fontsizeis documented in source2e.pdf. Didn't you found it?\selectfontseelatex.ltxaround line 2708.