diff --git a/ex00/ScalarConverter b/ex00/ScalarConverter deleted file mode 100755 index c726990..0000000 Binary files a/ex00/ScalarConverter and /dev/null differ diff --git a/ex00/ScalarConverter.cpp b/ex00/ScalarConverter.cpp index 3f0d1b7..a5c15c0 100644 --- a/ex00/ScalarConverter.cpp +++ b/ex00/ScalarConverter.cpp @@ -104,8 +104,6 @@ bool ScalarConverter::isDouble(const std::string& input) i++; } double d = atof(input.c_str()); - std::cout << "DEBUG double: d = " << d << std::endl; // ← AJOUTE - std::cout << "DEBUG isinf: " << std::isinf(d) << std::endl; // ← AJOUTE if (std::isinf(d)) return false; @@ -171,6 +169,7 @@ void ScalarConverter::toInt(const std::string &input) void ScalarConverter::toFloat(const std::string &input) { float f = static_cast(atof(input.c_str())); + if (f >= std::numeric_limits::min() && f <= std::numeric_limits::max()) { char c = static_cast(f); @@ -206,7 +205,11 @@ void ScalarConverter::toDouble(const std::string &input) std::cout << "int: \t" << static_cast(d) << std::endl; else std::cout << "int: \timpossible" << std::endl; - std::cout << "float: \t" << std::fixed << std::setprecision(1) << static_cast(d) << "f" << std::endl; + float f = static_cast(d); + if (std::isinf(f)) + std::cout << "float: \timpossible" << std::endl; + else + std::cout << "float: \t" << std::fixed << std::setprecision(1) << f << "f" << std::endl; std::cout << "double: \t" << d << std::endl; } @@ -242,4 +245,5 @@ void ScalarConverter::convert(const std::string &input) toOther(input); else std::cout <<"Invalid input." << std::endl; -} \ No newline at end of file +} + \ No newline at end of file diff --git a/ex00/obj/Main.o b/ex00/obj/Main.o deleted file mode 100644 index b4aff79..0000000 Binary files a/ex00/obj/Main.o and /dev/null differ diff --git a/ex00/obj/ScalarConverter.o b/ex00/obj/ScalarConverter.o deleted file mode 100644 index 9d903c4..0000000 Binary files a/ex00/obj/ScalarConverter.o and /dev/null differ