[#47211625] fix abs / fabs mixup

C Standard says `abs` takes int and returns int. For some reason Visual
Studio has a `double` version of it. By changing the calls from abs to
fabs we get MSVC and GCC returning the same output values.
[#47211625] Return const & where appropriate

Also add some timing debug logging.
[#47211625] adjust unit tests