Thanks. Now I understand exactly what you meant by "undefined behavior". Wouldn't the logic need to look something like:

```cpp
if (tmp > 0) {
  if (tmp >= FLT_MAX || tmp <= FLT_MIN)
    throw;
} else if (tmp < 0) {
  if (tmp <= -FLT_MAX || tmp >= -FLT_MIN)
    throw;
}
```

I'm sure there's a simplification here, but it's late and I'm not seeing it.