From 0c8f34b6fefcce9b12b3c1e35863ee767eb6476f Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Mon, 30 Dec 2024 23:51:23 +0300 Subject: [PATCH] asprintf.c: use `long double` type for calculation `2^32 - 1` --- c-programming/strings/asprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c-programming/strings/asprintf.c b/c-programming/strings/asprintf.c index ecb0f48..62a05aa 100644 --- a/c-programming/strings/asprintf.c +++ b/c-programming/strings/asprintf.c @@ -60,7 +60,7 @@ int main(void) { ssize_t result = asprintf(&output, "Hello%s! -- Unsigned 32-bit type is " "constrained to lie\nwithin the range of integer values from " "%" PRIu32 " to %" PRIu32 " inclusive.", world, 0, - (uint32_t) (powf(2.0f, 32.0f) - 1.0f)); + (uint32_t) (powl(2.0L, 32.0L) - 1.0L)); PRINT_ASSERT("no segmentation fault", true); PRINT_ASSERT("no errors occurred", result != -1);