Code Block (lldb) po (398.0 / 165.0).rounded() 2.53e-321
The expression may even crash when called from an attached debugger (the following expression returns 2.4121212... when no debugger attached):
Code Block (lldb) po (availableWidth / (cellRatio * (tileType.sectionHeight - 50))).rounded() error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x7c). The process has been returned to the state before expression evaluation.
The same operations are OK on a real device or in a playground on a Mac. It's also OK when converting the CGFloat to a Float and calling roundf() as follows:
Code Block (lldb) po CGFloat(roundf(Float(availableWidth / (cellRatio * (tileType.sectionHeight - 50))))) 2.0
Finally here are the results when passing various rounding rules to the rounded() method:
.toNearestOrAwayFromZero: crash in debugger
.toNearestOrEven: 2.412121212121212 (unchanged value)
.up: inf
.down: 2.412121212121212 (unchanged value)
.towardZero: 2.412121212121212 (unchanged value)
.awayFromZero: inf