Swift Rational - Swift package for working with rational numbers

Int ops are doing that – I mean they are doing overflow checks on normal ops like +, -, *, etc and trapping if overflow happens – so that kind of checking overhead should be totally fine for Rationals.

Typically you optimise the "happy path", the "unhappy path" performance is not so important because it is considered to happen rarely.

1 Like