better exception handling to diagnose a FloatDomainError