Compacted logarithm function