@@ -131,37 +131,49 @@ namespace te_builtins
131131 [[nodiscard]]
132132 constexpr static te_type te_equal (te_type val1, te_type val2) noexcept
133133 {
134- return static_cast <te_type>((val1 == val2) ? 1 : 0 );
134+ return (!std::isfinite (val1) || !std::isfinite (val2)) ?
135+ te_parser::te_nan :
136+ static_cast <te_type>((val1 == val2) ? 1 : 0 );
135137 }
136138
137139 [[nodiscard]]
138140 constexpr static te_type te_not_equal (te_type val1, te_type val2) noexcept
139141 {
140- return static_cast <te_type>((val1 != val2) ? 1 : 0 );
142+ return (!std::isfinite (val1) || !std::isfinite (val2)) ?
143+ te_parser::te_nan :
144+ static_cast <te_type>((val1 != val2) ? 1 : 0 );
141145 }
142146
143147 [[nodiscard]]
144148 constexpr static te_type te_less_than (te_type val1, te_type val2) noexcept
145149 {
146- return static_cast <te_type>((val1 < val2) ? 1 : 0 );
150+ return (!std::isfinite (val1) || !std::isfinite (val2)) ?
151+ te_parser::te_nan :
152+ static_cast <te_type>((val1 < val2) ? 1 : 0 );
147153 }
148154
149155 [[nodiscard]]
150156 constexpr static te_type te_less_than_equal_to (te_type val1, te_type val2) noexcept
151157 {
152- return static_cast <te_type>((val1 <= val2) ? 1 : 0 );
158+ return (!std::isfinite (val1) || !std::isfinite (val2)) ?
159+ te_parser::te_nan :
160+ static_cast <te_type>((val1 <= val2) ? 1 : 0 );
153161 }
154162
155163 [[nodiscard]]
156164 constexpr static te_type te_greater_than (te_type val1, te_type val2) noexcept
157165 {
158- return static_cast <te_type>((val1 > val2) ? 1 : 0 );
166+ return (!std::isfinite (val1) || !std::isfinite (val2)) ?
167+ te_parser::te_nan :
168+ static_cast <te_type>((val1 > val2) ? 1 : 0 );
159169 }
160170
161171 [[nodiscard]]
162172 constexpr static te_type te_greater_than_equal_to (te_type val1, te_type val2) noexcept
163173 {
164- return static_cast <te_type>((val1 >= val2) ? 1 : 0 );
174+ return (!std::isfinite (val1) || !std::isfinite (val2)) ?
175+ te_parser::te_nan :
176+ static_cast <te_type>((val1 >= val2) ? 1 : 0 );
165177 }
166178
167179 [[nodiscard]]
@@ -333,9 +345,9 @@ namespace te_builtins
333345 {
334346 return std::numeric_limits<te_type>::infinity ();
335347 }
336- const auto usignVal = static_cast <size_t >(val);
348+ const auto unsignedVal = static_cast <size_t >(val);
337349 uint32_t result{ 1 };
338- for (uint32_t i = 1 ; i <= usignVal ; i++)
350+ for (uint32_t i = 1 ; i <= unsignedVal ; i++)
339351 {
340352 if (i > (std::numeric_limits<uint32_t >::max)() / result)
341353 {
0 commit comments