Class FString: improve floating point exception handling

This commit is contained in:
Markus Gans 2015-06-30 00:25:36 +02:00
parent 21e9e0d397
commit 97cefa927f
2 changed files with 3 additions and 3 deletions

View File

@ -1027,7 +1027,7 @@ float FString::toFloat() const
double d;
d = this->toDouble();
if ( d > FLT_MAX || d < FLT_MIN )
if ( d > FLT_MAX || d < FLT_MIN )
throw std::overflow_error ("overflow");
return float(d);

View File

@ -126,9 +126,9 @@ int main (int, char**)
{
std::cerr << "Invalid argument: " << ex.what() << std::endl;
}
catch (const std::out_of_range& ex)
catch (const std::exception& ex)
{
std::cerr << "Out of range: " << ex.what() << std::endl;
std::cerr << "Arithmetic error: " << ex.what() << std::endl;
}
try