diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index 4637e87905..fce1fb9d0f 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -345,7 +345,11 @@ bool TokenFunc::asBool(const Token& t) { } double TokenFunc::asFloat(const Token& t) { const std::string str = asString(t); - return (double) atof(str.c_str()); + const char* start = str.c_str(); + char* end; + double result = strtod(start,&end); + if ( start == end ) throw IfcException("Token is not a real"); + return result; } std::string TokenFunc::asString(const Token& t) { if ( isOperator(t,'$') ) return "";