Consider a field $K$, let's say $K \subseteq \mathbb R$. We can consider the 'plane' $K \times K$. I am wondering in which cases the distance function $d: K \times K \to \mathbb R$, defined as is normal by $d(x, y) = \sqrt{x^2 + y^2}$, takes values in $K$.
Certainly this is not true for $\mathbb Q$: we have $d(1, 1) = \sqrt{2} \notin \mathbb Q$. If we take any $K$ which is closed under taking square roots of non-negative numbers, then certainly $d$ will take values in $K$.
However, a priori it might still be true that $a \in K$ positive has no square root, yet this does not provide an obstruction because there is no way to write $a = x^2 + y^2$. Thus I am wondering:
Are there fields $K \subseteq \mathbb R$ which do not have all square roots of positive numbers, yet are closed under $d$?