Some implementations of scale calculation + some test.