d06 ex00 ajout qq tests avec limits des floats

This commit is contained in:
hugogogo
2022-03-10 16:14:01 +01:00
parent 04dea6722f
commit 31c9d8af06
10 changed files with 161 additions and 58 deletions

View File

@@ -17,6 +17,14 @@ bool checkInt(std::string str);
bool checkFloat(std::string str);
bool checkDouble(std::string str);
// templates
// see : https://isocpp.org/wiki/faq/templates#templates-defn-vs-decl
template <typename T> void toChar(T value);
template <typename T> void toInt(T value);
template <typename T> void toFloat(T value);
template <typename T> void toDouble(T value);
//template <typename T> void printDot(T value);
#define MAX_INT "2147483647"
#define MIN_INT "-2147483648"
#define MAX_INT_1 "2147483648"
@@ -24,6 +32,7 @@ bool checkDouble(std::string str);
#define INT_MAX_LENGTH 10
#define MAX_FLOAT_INT_PRECISION "16777216"
#define MAX_FLOAT "340282346638528859811704183484516925440"
#define MIN_FLOAT "-340282346638528859811704183484516925440"
#define FLOAT_MAX_LENGTH 39
#define MAX_DOUBLE "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368"
#define DOUBLE_MAX_LENGTH 309
@@ -49,6 +58,7 @@ bool checkDouble(std::string str);
#define MAX_F_4 "340282346638528859811704183484516925444"
#define MAX_F_5 "340282346638528859811704183484516925445"
#define MAX_F_6 "340282346638528859811704183484516925446"
#define MAX_F_N "340282346638528897590636046441678635008"
#define MIN_DOUBLE "-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368"
#define MAX_D__1 "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858367"
#define MAX_D__2 "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858366"