aboutsummaryrefslogtreecommitdiff
path: root/cpp06/ex00/main.cpp
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-12-14 11:18:40 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-12-14 11:18:40 +0100
commitb13cd117a7957f9d86ec2986b47349979325a854 (patch)
treefcdb302deb45f95bdd8495c5c03ea0e45ce77275 /cpp06/ex00/main.cpp
parent2ee90625e793175c5fcde47564326a7eb8a1b3ee (diff)
downloadpiscine_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/main.cpp')
-rw-r--r--cpp06/ex00/main.cpp5
1 files changed, 3 insertions, 2 deletions
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);