Look:

$calc(9999999999999999) => 9999999999999998
$calc(3^40) => 12157665459056929000: False, 3^40 is equal to 1215766545905692801.

Instead of returning a false result, it would be more judicious to return nothing ($null) or an error message.