[MRG+1] More informative numerical error message in SGD

Also add a test.

Ping @pprett, @mblondel.