diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-12-14 11:18:40 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-12-14 11:18:40 +0100 |
| commit | b13cd117a7957f9d86ec2986b47349979325a854 (patch) | |
| tree | fcdb302deb45f95bdd8495c5c03ea0e45ce77275 /cpp06/ex00 | |
| parent | 2ee90625e793175c5fcde47564326a7eb8a1b3ee (diff) | |
| download | piscine_cpp-b13cd117a7957f9d86ec2986b47349979325a854.tar.gz piscine_cpp-b13cd117a7957f9d86ec2986b47349979325a854.tar.bz2 piscine_cpp-b13cd117a7957f9d86ec2986b47349979325a854.zip | |
Fixing nanf not recognized in cpp06/00, Fixing serialization size to 52 bytes
Diffstat (limited to 'cpp06/ex00')
| -rw-r--r-- | cpp06/ex00/Makefile | 4 | ||||
| -rw-r--r-- | cpp06/ex00/main.cpp | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/cpp06/ex00/Makefile b/cpp06/ex00/Makefile index e0de1f1..f548628 100644 --- a/cpp06/ex00/Makefile +++ b/cpp06/ex00/Makefile @@ -6,14 +6,14 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/04/15 09:59:30 by charles #+# #+# # -# Updated: 2020/12/13 16:00:15 by charles ### ########.fr # +# Updated: 2020/12/14 10:53:21 by cacharle ### ########.fr # # # # **************************************************************************** # NAME = convert CXX = clang++ -CXXFLAGS = -std=c++98 -Wall -Wextra -Werror +CXXFLAGS = -Wall -Wextra -Werror SRC = main.cpp OBJ = $(SRC:.cpp=.o) diff --git a/cpp06/ex00/main.cpp b/cpp06/ex00/main.cpp index a0ef7f8..b66ff4e 100644 --- a/cpp06/ex00/main.cpp +++ b/cpp06/ex00/main.cpp @@ -6,7 +6,7 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/16 10:54:10 by charles #+# #+# */ -/* Updated: 2020/12/13 17:11:08 by charles ### ########.fr */ +/* Updated: 2020/12/14 10:53:10 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -58,6 +58,8 @@ bool is_float(std::string input) { if (input[input.length() - 1] != 'f') return false; + if (input == "nanf" || input == "+inff" || input == "-inff") + return true; if (input.find('.') == std::string::npos) input.insert(input.length() - 1, ".0"); return is_double(input.substr(0, input.length() - 1)); @@ -120,7 +122,6 @@ int main(int argc, char **argv) return 1; } - if (CHAR_MIN <= x && x <= CHAR_MAX && !std::isnan(x) && !std::isinf(x)) { char c = static_cast<char>(x); |
