2 ms·
`INIT $RAT-OVERFLOW = CX::Warn` will produce a warning whenever a switch to Num happens. `INIT $RAT-OVERFLOW = Exception` will throw an exception whenever a sw
by lizmat 3y ago
`INIT $RAT-OVERFLOW = CX::Warn` will produce a warning whenever a switch to Num happens.
`INIT $RAT-OVERFLOW = Exception` will throw an exception whenever a switch to Num would happen.
If you want to define your own behaviour, you can. For instance:
class ZeroOrInf {
method UPGRADE-RAT(Int $nu, Int $de) {
$nu > $de ?? Inf !! 0
}
}
INIT $*RAT-OVERFLOW = ZeroOrInf
would either convert the value to `Inf`if too large, or to `0` if too small.