I thought I found a way to make it way simpler but actually it works way less well... This way doesn't work with decimals, negative numbers, or zero, so it actually just doesn't work.