I have an NSDecimal in a tight calculations loop, where I need to floor the value. I want to prevent creating fat NSDecimalNumber objects just for that. Is there a cost-efficient way to get a floor? That floor is just needed to calculate how many times another value might fit in there, with no rest. The NSDecimal API doesn’t provide something like floor…
Share
You can use the
NSDecimalRound()function with theNSRoundDownrounding mode:For more info take a look at the docs here.