Supposing MyMod::f(double) is wrapped, the following fails with OverflowError
perl -e 'use MyMod; use Errno; $! = Errno::ERANGE; MyMod::f("3.5")'
The problem is that strtod sets errno on error, but does not clear it, and there is no clear "bad" return code from strtod (zero, for example, could be the result of an underflow).
Attached patch clears errno=0 before calling strtod.