From ba3835af61c90017aca90efeb63a60590d9ea04b Mon Sep 17 00:00:00 2001 From: anastasosmoho Date: Thu, 1 Oct 2026 18:06:35 +0000 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82=D1=8C=20wo?= =?UTF-8?q?rks/pr2/2detektor/main2.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- works/pr2/2detektor/main2.cpp | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 works/pr2/2detektor/main2.cpp diff --git a/works/pr2/2detektor/main2.cpp b/works/pr2/2detektor/main2.cpp deleted file mode 100644 index 16ec30b..0000000 --- a/works/pr2/2detektor/main2.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include -int is_nan(float f){ - uint32_t bits; - memcpy(&bits, &f, sizeof(bits)); // безопасный type punning - uint32_t exp = (bits >> 23) & 0xFFu; // 8 бит экспоненты - uint32_t mant = bits & 0x7FFFFFu; // 23 бита мантиссы - return (exp == 0xFFu) && (mant != 0u); -} -int main() { - float zero = 0.0f; - float nan1 = 0.0f / zero; // 0/0 -> NaN - float inf = 1.0f / zero; // 1/0 -> +inf - printf("is_nan(1.0f) = %d\n", is_nan(1.0f)); // 0 - printf("is_nan(0/0) = %d\n", is_nan(nan1)); // 1 - printf("is_nan(1/0) = %d\n", is_nan(inf)); // 0 (это inf, не NaN) - return 0; -}