lib: Move mathematic helpers to separate folder