added tests, fixed losing float precision