Just a side comment to this question.
In the real world nothing is so obvious.
Example:
Try to define Hadamard gate in Ruby language.
Even when trying to define gate by using rational numbers which helps us sometimes to keep good precision the answer is that Hadamard is not unitary.
m = (1 / Math.sqrt(2)).to_r * Matrix[[1, 1],
[1, -1]]
Then
m.unitary?
results false and result of m*m multiplication is as below:
Matrix[[2535301200456458353478625262249/2535301200456458802993406410752, 0/1],
[0/1, 2535301200456458353478625262249/2535301200456458802993406410752]]
That means if we really want to be sure that something is 'true' as it should be, we need to double check existing feature in language and maybe fix/write own code when needed.