// ===================================================================================================================== // fennec-metaprogramming, a program to generate metaprogramming intrinsics // Copyright © 2025 Medusa Slockbower // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // ===================================================================================================================== #include #include int main(int, const char**) { std::ofstream flt("float.h"); flt << "// =====================================================================================================================" << std::endl; flt << "// fennec, a free and open source game engine" << std::endl; flt << "// Copyright © 2025 Medusa Slockbower" << std::endl; flt << "//" << std::endl; flt << "// This program is free software: you can redistribute it and/or modify" << std::endl; flt << "// it under the terms of the GNU General Public License as published by" << std::endl; flt << "// the Free Software Foundation, either version 3 of the License, or" << std::endl; flt << "// (at your option) any later version." << std::endl; flt << "//" << std::endl; flt << "// This program is distributed in the hope that it will be useful," << std::endl; flt << "// but WITHOUT ANY WARRANTY; without even the implied warranty of" << std::endl; flt << "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" << std::endl; flt << "// GNU General Public License for more details." << std::endl; flt << "//" << std::endl; flt << "// You should have received a copy of the GNU General Public License" << std::endl; flt << "// along with this program. If not, see ." << std::endl; flt << "// =====================================================================================================================" << std::endl; flt << "" << std::endl; flt << "///" << std::endl; flt << "/// \\file float.h" << std::endl; flt << "/// \\brief metaprogramming floating point type info" << std::endl; flt << "///" << std::endl; flt << "///" << std::endl; flt << "/// \\details this file is automatically generated for the current build environment" << std::endl; flt << "///" << std::endl; flt << "/// \\copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))" << std::endl; flt << "///" << std::endl; flt << "///" << std::endl; flt << "" << std::endl; flt << "#include " << std::endl; flt << "" << std::endl; flt << "#define FLT_HAS_INFINITY " << std::dec << std::numeric_limits::has_infinity << std::endl; flt << "#define FLT_HAS_QUIET_NAN " << std::dec << std::numeric_limits::has_quiet_NaN << std::endl; flt << "#define FLT_HAS_SIGNALING_NAN " << std::dec << std::numeric_limits::has_signaling_NaN << std::endl; flt << "#define FLT_HAS_DENORM " << std::dec << std::numeric_limits::has_denorm << std::endl; flt << "#define FLT_HAS_DENORM_LOSS " << std::dec << std::numeric_limits::has_denorm_loss << std::endl; flt << "#define FLT_ROUNDS " << std::dec << std::numeric_limits::round_style << std::endl; flt << "#define FLT_IS_IEC559 " << std::dec << std::numeric_limits::is_iec559 << std::endl; flt << "#define FLT_MANT_DIG " << std::dec << std::numeric_limits::digits << std::endl; flt << "#define FLT_DIG " << std::dec << std::numeric_limits::digits10 << std::endl; flt << "#define FLT_DECIMAL_DIG " << std::dec << std::numeric_limits::max_digits10 << std::endl; flt << "#define FLT_RADIX " << std::dec << std::numeric_limits::radix << std::endl; flt << "#define FLT_MIN_EXP " << std::dec << std::numeric_limits::min_exponent << std::endl; flt << "#define FLT_MAX_EXP " << std::dec << std::numeric_limits::max_exponent << std::endl; flt << "#define FLT_MIN_10_EXP " << std::dec << std::numeric_limits::min_exponent10 << std::endl; flt << "#define FLT_MAX_10_EXP " << std::dec << std::numeric_limits::max_exponent10 << std::endl; flt << "#define FLT_TRAPS " << std::dec << std::numeric_limits::traps << std::endl; flt << "#define FLT_TINYNESS_BEFORE " << std::dec << std::numeric_limits::tinyness_before << std::endl; flt << "#define FLT_MIN " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::min() ) << ")" << std::endl; flt << "#define FLT_MAX " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::max() ) << ")" << std::endl; flt << "#define FLT_EPSILON " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::epsilon() ) << ")" << std::endl; flt << "#define FLT_INF " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::infinity() ) << ")" << std::endl; flt << "#define FLT_QUIET_NAN " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::quiet_NaN() ) << ")" << std::endl; flt << "#define FLT_SIGNALING_NAN " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::signaling_NaN()) << ")" << std::endl; flt << "#define FLT_DENORM_MIN " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::denorm_min() ) << ")" << std::endl; flt << "#define FLT_ROUND_ERR " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::round_error() ) << ")" << std::endl; flt << "" << std::endl; flt << "#define DBL_HAS_INFINITY " << std::dec << std::numeric_limits::has_infinity << std::endl; flt << "#define DBL_HAS_QUIET_NAN " << std::dec << std::numeric_limits::has_quiet_NaN << std::endl; flt << "#define DBL_HAS_SIGNALING_NAN " << std::dec << std::numeric_limits::has_signaling_NaN << std::endl; flt << "#define DBL_HAS_DENORM " << std::dec << std::numeric_limits::has_denorm << std::endl; flt << "#define DBL_HAS_DENORM_LOSS " << std::dec << std::numeric_limits::has_denorm_loss << std::endl; flt << "#define DBL_ROUNDS " << std::dec << std::numeric_limits::round_style << std::endl; flt << "#define DBL_IS_IEC559 " << std::dec << std::numeric_limits::is_iec559 << std::endl; flt << "#define DBL_MANT_DIG " << std::dec << std::numeric_limits::digits << std::endl; flt << "#define DBL_DIG " << std::dec << std::numeric_limits::digits10 << std::endl; flt << "#define DBL_DECIMAL_DIG " << std::dec << std::numeric_limits::max_digits10 << std::endl; flt << "#define DBL_RADIX " << std::dec << std::numeric_limits::radix << std::endl; flt << "#define DBL_MIN_EXP " << std::dec << std::numeric_limits::min_exponent << std::endl; flt << "#define DBL_MAX_EXP " << std::dec << std::numeric_limits::max_exponent << std::endl; flt << "#define DBL_MIN_10_EXP " << std::dec << std::numeric_limits::min_exponent10 << std::endl; flt << "#define DBL_MAX_10_EXP " << std::dec << std::numeric_limits::max_exponent10 << std::endl; flt << "#define DBL_TRAPS " << std::dec << std::numeric_limits::traps << std::endl; flt << "#define DBL_TINYNESS_BEFORE " << std::dec << std::numeric_limits::tinyness_before << std::endl; flt << "#define DBL_MIN " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::min() ) << "l)" << std::endl; flt << "#define DBL_MAX " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::max() ) << "l)" << std::endl; flt << "#define DBL_EPSILON " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::epsilon() ) << "l)" << std::endl; flt << "#define DBL_INF " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::infinity() ) << "l)" << std::endl; flt << "#define DBL_QUIET_NAN " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::quiet_NaN() ) << "l)" << std::endl; flt << "#define DBL_SIGNALING_NAN " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::signaling_NaN()) << "l)" << std::endl; flt << "#define DBL_DENORM_MIN " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::denorm_min() ) << "l)" << std::endl; flt << "#define DBL_ROUND_ERR " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::round_error() ) << "l)" << std::endl; flt.close(); return 0; }