Artificial intelligent assistant

Does rationalizing the denominator lead to more or less round-off error? I evaluated $\frac{1}{\sqrt{2}}$ and $\frac{\sqrt{2}}{2}$ in Matlab, and got a slight difference: $0.707106781186547$ and $0.707106781186548$, respectively. Which is more accurate, the one with the denominator rationalized, or the one without it rationalized?

In this case, the value is $0.707106781186547524400844362104849039284835937688474036588339...$, so the second is (marginally) closer. I wouldn't expect there to be a uniform rule on which is more accurate, depending on what expressions you are considering. The point about division by $2$ being exact in computer math does not extend to $\frac 1{\sqrt 3}$ versus $\frac {\sqrt 3}3$, for example.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 8123042d5e88daf57c7ee3bcc5b0592c