What happens to units of values treated with sin, cos...?

92 Views Asked by At

I know what happens when I compute a square root of 9 square metres - it's just 3 metres. But what about more weird cases, like:

  • sqrt(4m) - square root of 4 metres - is it 2 square-roots-of-metres of some sort?
  • sin(4m)
  • log(4m)

For context:

I know that those values (and their units) probably don't make much sense in real world, but I'm wondering if a unit-aware all-purpose calculator can exist, and how it should react: should it disallow some operations, make values unitless as a result of some operations, or brute force the units somehow.

Imagine that you have a calculator that has buttons for metres, amperes, lumens, kelvins etc, as well as some SI derived units (newtons, ohms...) and maybe a bunch of unit-aware constants (c = 299 792 458 m/s). How would such calculator behave?